6 VERSIONHI = @VERSIONHI@
7 VERSIONLO = @VERSIONLO@
16 INCDIR = $(PRJDIR)/device/include
18 CC = $(PRJDIR)/bin/sdcc
19 CPP = $(PRJDIR)/bin/sdcpp
22 exec_prefix = @exec_prefix@
26 includedir = @includedir@
28 man1dir = $(mandir)/man1
29 man2dir = $(mandir)/man2
33 lib_dir_suffix = @lib_dir_suffix@
35 sdcc_libdir = $(datadir)/$(lib_dir_suffix)
37 CPPFLAGS = -I$(INCDIR)
38 CFLAGS = $(MODELFLAGS) --nostdinc
43 PORTDIR = $(BUILDDIR)/$(PORT)
45 SOURCES = _atof.c _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \
46 _decdptr.c _divsint.c _divslong.c _divuint.c \
47 _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
48 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
49 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
50 _fsneq.c _fssub.c _gptrget.c _gptrgetc.c _gptrput.c \
51 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
52 _islower.c _isprint.c _ispunct.c _isspace.c \
53 _isupper.c _isxdigit.c _itoa.c _ltoa.c \
54 _slong2fs.c _memcmp.c \
55 _memcpy.c _memmove.c _memset.c _modsint.c _modslong.c \
56 _moduint.c _modulong.c _mulint.c _mullong.c \
58 _spx.c _startup.c _strchr.c _strcmp.c _strcpy.c \
59 _strcspn.c _strlen.c _strncat.c _strncmp.c \
60 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
62 _uchar2fs.c _uint2fs.c _ulong2fs.c \
63 calloc.c malloc.c realloc.c free.c \
64 serial.c ser_ir.c printfl.c \
65 printf_large.c vprintf.c puts.c gets.c \
66 assert.c _strcat.c time.c printf_fast.c bpx.c \
67 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
68 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
69 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
70 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
72 OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
74 Z80SOURCES = _atof.c _atoi.c \
75 _iscntrl.c _isdigit.c _isgraph.c \
76 _islower.c _isprint.c _ispunct.c _isspace.c \
77 _isupper.c _isxdigit.c _memcmp.c \
78 _memcpy.c _memmove.c _memset.c \
79 _startup.c _strchr.c _strcmp.c _strcpy.c \
80 _strcspn.c _strlen.c _strncat.c _strncmp.c \
81 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
85 _modslong.c _modulong.c \
87 _divslong.c _divulong.c \
88 calloc.c malloc.c realloc.c free.c \
89 _fs2schar.c _fs2sint.c _fs2slong.c \
90 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
91 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
93 _uchar2fs.c _uint2fs.c \
95 _slong2fs.c _sint2fs.c _schar2fs.c
97 Z80OBJECTS = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
99 XA51SOURCES = _atof.c _atoi.c _atol.c _schar2fs.c \
100 _divsint.c _divslong.c _divuint.c \
101 _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
102 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
103 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
105 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
106 _islower.c _isprint.c _ispunct.c _isspace.c \
107 _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
108 _memcpy.c _memmove.c _memset.c _modsint.c _modslong.c \
109 _moduint.c _modulong.c _mulint.c _mullong.c \
110 _strchr.c _strcmp.c _strcpy.c \
111 _strcspn.c _strlen.c _strncat.c _strncmp.c \
112 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
113 _strstr.c _strtok.c \
114 _uchar2fs.c _uint2fs.c _ulong2fs.c \
115 calloc.c malloc.c realloc.c free.c \
117 printf_large.c puts.c gets.c \
118 assert.c _strcat.c time.c \
119 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
120 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
121 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
122 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
124 XA51OBJECTS = $(XA51SOURCES:%.c=$(PORTDIR)/%.rel)
126 HC08SOURCES = _atof.c _atoi.c _atol.c _schar2fs.c \
127 _divsint.c _divslong.c \
128 _fs2schar.c _fs2sint.c _fs2slong.c \
129 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
130 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
132 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
133 _islower.c _isprint.c _ispunct.c _isspace.c \
134 _isupper.c _isxdigit.c _itoa.c _ltoa.c \
135 _slong2fs.c _memcmp.c \
136 _memcpy.c _memmove.c _memset.c _modsint.c _modslong.c \
137 _moduint.c _modulong.c \
138 _spx.c _startup.c _strchr.c _strcmp.c _strcpy.c \
139 _strcspn.c _strlen.c _strncat.c _strncmp.c \
140 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
141 _strstr.c _strtok.c \
142 _uchar2fs.c _uint2fs.c _ulong2fs.c \
143 calloc.c malloc.c realloc.c free.c \
144 assert.c _strcat.c time.c \
145 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
146 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
147 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
148 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
150 HC08OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(HC08SOURCES))
156 # Compiling entire program or any subproject
157 # ------------------------------------------
158 all: checkconf models model-ds390 model-ds400 model-z80 model-gbz80 model-hc08
162 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
165 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
166 for model in $(MODELS); do \
167 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
172 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
173 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
177 if [ "`grep ds400 ../../ports.build`" = ds400 ]; then \
178 $(MAKE) MODELFLAGS="-mds400" PORT=ds400 objects; \
182 if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
183 $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
186 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
187 cd $(PORTDIR); ls *$(OEXT) > lib$(PORT).lib
190 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
191 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
195 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
196 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
199 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects clean_intermediate
200 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
203 if [ "`grep hc08 ../../ports.build`" = hc08 ]; then \
204 $(MAKE) MODELFLAGS="-mhc08" PORT=hc08 objects-hc08; \
207 objects-hc08: build-dir $(HC08OBJECTS) port-specific-objects clean_intermediate
208 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
211 if [ "`grep pic16 ../../ports.build`" = pic16 ]; then \
212 $(MAKE) MODELFLAGS="-mpic16" PORT=pic16 OEXT=.lib objects-pic16; \
215 objects-pic16: build-dir port-specific-objects-pic16 clean_intermediate-pic16
216 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
219 build-dir: $(PORTDIR)
224 port-specific-objects:
225 if [ -d $(PORT) ]; then \
226 $(MAKE) -C $(PORT); \
227 cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
230 port-specific-objects-pic16:
231 if [ -d $(PORT) ]; then \
232 $(MAKE) -C $(PORT); \
233 cp -f $(PORT)/bin/* $(PORTDIR); \
240 rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
242 clean_intermediate-pic16:
243 $(MAKE) -C $(PORT) clean-intermediate
245 # Compiling and installing everything and runing test
246 # ---------------------------------------------------
247 install: all installdirs
248 cp -r -u $(BUILDDIR)/* $(sdcc_libdir)
249 cp -r -u ds390 ds400 gbz80 z80 hc08 *.c $(sdcc_libdir)/src
250 rm -r `find $(sdcc_libdir)/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm' -or -name 'CVS'`
252 # Deleting all the installed files
253 # --------------------------------
255 rm -rf $(sdcc_libdir)
257 # Performing self-test
258 # --------------------
262 # Performing installation test
263 # ----------------------------
267 # Creating installation directories
268 # ---------------------------------
270 [ -d $(sdcc_libdir) ] || mkdir -p $(sdcc_libdir)
271 for model in $(MODELS); do \
272 [ -d $(sdcc_libdir)/$$model ] || \
273 mkdir -p $(sdcc_libdir)/$$model; \
275 [ -d $(sdcc_libdir)/ds390 ] || mkdir -p $(sdcc_libdir)/ds390
276 [ -d $(sdcc_libdir)/ds400 ] || mkdir -p $(sdcc_libdir)/ds400
277 [ -d $(sdcc_libdir)/hc08 ] || mkdir -p $(sdcc_libdir)/hc08
278 [ -f $(sdcc_libdir)/pic16 ] || mkdir -p $(sdcc_libdir)/pic16
279 mkdir -p $(sdcc_libdir)/src
281 # Creating dependencies
282 # ---------------------
285 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
287 for i in $(SOURCES); do \
288 $(CPP) -std=c99 -M $(CPPFLAGS) $$i >$${i}.dep; \
289 cat $${i}.dep >>Makefile.dep; \
301 $(PORTDIR)/%$(OEXT): %.c
302 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
304 # Remaking configuration
305 # ----------------------
307 @if [ -f $(PRJDIR)/devel ]; then\
308 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
312 # End of main_in.mk/main.mk