0
|
1 |
#! gmake
|
|
2 |
|
|
3 |
#
|
|
4 |
# Copyright (C) 2006 Laurent Bessard
|
|
5 |
#
|
|
6 |
# This file is part of canfestival, a library implementing the canopen
|
|
7 |
# stack
|
|
8 |
#
|
|
9 |
# This library is free software; you can redistribute it and/or
|
|
10 |
# modify it under the terms of the GNU Lesser General Public
|
|
11 |
# License as published by the Free Software Foundation; either
|
|
12 |
# version 2.1 of the License, or (at your option) any later version.
|
|
13 |
#
|
|
14 |
# This library is distributed in the hope that it will be useful,
|
|
15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
17 |
# Lesser General Public License for more details.
|
|
18 |
#
|
|
19 |
# You should have received a copy of the GNU Lesser General Public
|
|
20 |
# License along with this library; if not, write to the Free Software
|
|
21 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
22 |
#
|
|
23 |
|
|
24 |
CC = SUB_CC
|
|
25 |
|
|
26 |
CFLAGS = SUB_OPT_CFLAGS
|
|
27 |
PROG_CFLAGS = SUB_PROG_CFLAGS
|
|
28 |
OS_NAME = SUB_OS_NAME
|
|
29 |
ARCH_NAME = SUB_ARCH_NAME
|
|
30 |
PREFIX = SUB_PREFIX
|
|
31 |
BINUTILS_PREFIX = SUB_BINUTILS_PREFIX
|
|
32 |
TARGET = SUB_TARGET
|
|
33 |
|
|
34 |
|
|
35 |
INCLUDES = -I../../include -I../../include/hcs12
|
|
36 |
MEMORY_X = ../../include/hcs12/board/arch
|
|
37 |
|
|
38 |
OBJCOPY = $(BINUTILS_PREFIX)objcopy
|
|
39 |
OBJCOPY_FLAGS = --only-section=.text --only-section=.rodata --only-section=.vectors --only-section=.data
|
|
40 |
|
|
41 |
PROGDEFINES = -mnoshort -Wall -Wmissing-prototypes -fno-strict-aliasing
|
|
42 |
|
|
43 |
PGR=geneSYNC
|
|
44 |
|
|
45 |
SYNC_OBJS = objdict.o appli.o vectors.o
|
|
46 |
|
|
47 |
OBJS = ../../src/$(TARGET)_pdo.o\
|
|
48 |
../../src/$(TARGET)_sdo.o\
|
|
49 |
../../src/$(TARGET)_states.o\
|
|
50 |
../../src/$(TARGET)_sync.o\
|
|
51 |
../../src/$(TARGET)_objacces.o\
|
|
52 |
../../src/$(TARGET)_lifegrd.o\
|
|
53 |
../../src/$(TARGET)_timer.o\
|
|
54 |
../../src/$(TARGET)_nmtSlave.o\
|
|
55 |
../../drivers/$(TARGET)/canOpenDriver.o\
|
|
56 |
../../drivers/$(TARGET)/ports.o\
|
|
57 |
../../drivers/$(TARGET)/interrupt.o\
|
|
58 |
$(SYNC_OBJS)
|
|
59 |
|
|
60 |
LDFLAGS= -Wl,-m,m68hc12elfb -L$(MEMORY_X)
|
|
61 |
|
|
62 |
all: $(PGR).elf $(PGR).s19 $(PGR).b $(PGR).s MSG
|
|
63 |
|
|
64 |
%o: %c
|
|
65 |
@echo " "
|
|
66 |
@echo "*********************************************"
|
|
67 |
@echo "**Compiling $< -> $@"
|
|
68 |
@echo "*********************************************"
|
|
69 |
$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -c -o $@ $<
|
|
70 |
|
|
71 |
%o: %s
|
|
72 |
@echo " "
|
|
73 |
@echo "*********************************************"
|
|
74 |
@echo "**Compiling $< -> $@"
|
|
75 |
@echo "*********************************************"
|
|
76 |
$(CC) -c -x assembler-with-cpp $(PROG_CFLAGS) -o $@ $<
|
|
77 |
|
|
78 |
$(PGR).elf: $(OBJS)
|
|
79 |
@echo " "
|
|
80 |
@echo "============================================="
|
|
81 |
@echo "**Linking : $@"
|
|
82 |
@echo "============================================="
|
|
83 |
$(CC) $(CFLAGS) $(LDFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS)
|
|
84 |
|
|
85 |
$(PGR).s19: $(PGR).elf
|
|
86 |
@echo " "
|
|
87 |
@echo "============================================="
|
|
88 |
@echo "**Create s19 file : $@"
|
|
89 |
@echo "============================================="
|
|
90 |
$(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $@
|
|
91 |
|
|
92 |
$(PGR).b: $(PGR).elf
|
|
93 |
@echo " "
|
|
94 |
@echo "============================================="
|
|
95 |
@echo "**Create binary file : $@"
|
|
96 |
@echo "============================================="
|
|
97 |
$(OBJCOPY) --output-target=binary --gap-fill=255 --only-section=.data $(OBJCOPY_FLAGS) $< $@
|
|
98 |
|
|
99 |
$(PGR).s: $(PGR).elf
|
|
100 |
@echo " "
|
|
101 |
@echo "============================================="
|
|
102 |
@echo "**Create unassembled file : $@"
|
|
103 |
@echo "============================================="
|
|
104 |
$(BINUTILS_PREFIX)objdump -D $(PGR).elf > $(PGR).s
|
|
105 |
|
|
106 |
MSG:
|
|
107 |
@echo " "
|
|
108 |
@echo "---------------------------------------------"
|
|
109 |
@echo "**Informations on elf file : $(PGR).elf "
|
|
110 |
@echo "---------------------------------------------"
|
|
111 |
$(BINUTILS_PREFIX)readelf -S $(PGR).elf
|
|
112 |
@echo
|
|
113 |
$(BINUTILS_PREFIX)size $(PGR).elf
|
|
114 |
|
|
115 |
clean:
|
|
116 |
-\rm $(SYNC_OBJS)
|
|
117 |
|
|
118 |
mrproper: clean
|
|
119 |
-\rm $(PGR).elf $(PGR).s19 $(PGR).b $(PGR).s
|
|
120 |
|