6 VERSIONHI = @VERSIONHI@
7 VERSIONLO = @VERSIONLO@
16 INCDIR = $(PRJDIR)/device/include
18 PORTINCDIR = $(INCDIR)/mcs51
21 CC = $(PRJDIR)/bin/sdcc
22 CPP = $(PRJDIR)/bin/sdcpp
25 exec_prefix = @exec_prefix@
29 includedir = @includedir@
31 man1dir = $(mandir)/man1
32 man2dir = $(mandir)/man2
36 lib_dir_suffix = @lib_dir_suffix@
38 sdcc_libdir = $(DESTDIR)$(datadir)/$(lib_dir_suffix)
40 CPPFLAGS = -I$(INCDIR) -I$(PORTINCDIR)
41 CFLAGS = $(MODELFLAGS) --nostdinc
46 PORTDIR = $(BUILDDIR)/$(PORT)
48 SOURCES = _atof.c _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \
49 _decdptr.c _divsint.c _divslong.c _divuint.c \
50 _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
51 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
52 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fscmp.c _fsmul.c \
53 _fsneq.c _fssub.c _gptrget.c _gptrgetc.c _gptrput.c \
54 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
55 _islower.c _isprint.c _ispunct.c _isspace.c \
56 _isupper.c _isxdigit.c _itoa.c _ltoa.c \
58 _memcmp.c _memcpy.c _memmove.c _memset.c \
59 _modsint.c _modslong.c _moduint.c _modulong.c \
60 _mulint.c _mullong.c \
64 _strcat.c _strchr.c _strcmp.c _strcpy.c \
65 _strcspn.c _strlen.c _strncat.c _strncmp.c \
66 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
68 _uchar2fs.c _uint2fs.c _ulong2fs.c \
69 calloc.c malloc.c realloc.c free.c \
70 serial.c ser_ir.c printfl.c \
71 printf_large.c sprintf.c vprintf.c puts.c gets.c \
72 printf_fast.c printf_fast_f.c printf_tiny.c \
73 assert.c time.c bpx.c \
74 _fsget1arg.c _fsget2args.c _fsnormalize.c \
75 _fsreturnval.c _fsrshift.c _fsswapargs.c _logexpf.c \
76 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
77 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
78 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
79 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
81 OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
83 Z80SOURCES = _atof.c _atoi.c \
84 _iscntrl.c _isdigit.c _isgraph.c \
85 _islower.c _isprint.c _ispunct.c _isspace.c \
86 _isupper.c _isxdigit.c \
87 _memcmp.c _memcpy.c _memmove.c _memset.c \
89 _strcat.c _strchr.c _strcmp.c _strcpy.c \
90 _strcspn.c _strlen.c _strncat.c _strncmp.c \
91 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
94 _modslong.c _modulong.c \
97 _divslong.c _divulong.c \
98 calloc.c malloc.c realloc.c free.c \
99 printf_large.c sprintf.c vprintf.c puts.c gets.c \
100 _fs2schar.c _fs2sint.c _fs2slong.c \
101 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
102 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
104 _uchar2fs.c _uint2fs.c \
106 _slong2fs.c _sint2fs.c _schar2fs.c
108 Z80OBJECTS = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
110 XA51SOURCES = _atof.c _atoi.c _atol.c _schar2fs.c \
111 _divsint.c _divslong.c _divuint.c \
112 _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
113 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
114 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
116 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
117 _islower.c _isprint.c _ispunct.c _isspace.c \
118 _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
119 _memcpy.c _memmove.c _memset.c _modsint.c _modslong.c \
120 _moduint.c _modulong.c _mulint.c _mullong.c \
122 _strcat.c _strchr.c _strcmp.c _strcpy.c \
123 _strcspn.c _strlen.c _strncat.c _strncmp.c \
124 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
125 _strstr.c _strtok.c \
126 _uchar2fs.c _uint2fs.c _ulong2fs.c \
127 calloc.c malloc.c realloc.c free.c \
129 printf_large.c puts.c gets.c \
131 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
132 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
133 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
134 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
136 XA51OBJECTS = $(XA51SOURCES:%.c=$(PORTDIR)/%.rel)
138 HC08SOURCES = _atof.c _atoi.c _atol.c _schar2fs.c \
139 _divsint.c _divslong.c \
140 _fs2schar.c _fs2sint.c _fs2slong.c \
141 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
142 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
144 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
145 _islower.c _isprint.c _ispunct.c _isspace.c \
146 _isupper.c _isxdigit.c _itoa.c _ltoa.c \
148 _memcmp.c _memcpy.c _memmove.c _memset.c \
149 _modsint.c _modslong.c _moduint.c _modulong.c \
152 _strcat.c _strchr.c _strcmp.c _strcpy.c \
153 _strcspn.c _strlen.c _strncat.c _strncmp.c \
154 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
155 _strstr.c _strtok.c \
156 _uchar2fs.c _uint2fs.c _ulong2fs.c \
157 calloc.c malloc.c realloc.c free.c \
158 printf_large.c sprintf.c vprintf.c \
160 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
161 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
162 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
163 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
165 HC08OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(HC08SOURCES))
171 # Compiling entire program or any subproject
172 # ------------------------------------------
173 all: checkconf models model-ds390 model-ds400 model-z80 model-gbz80 model-hc08
176 # (needs gputils curently not available of sourceforge's compile farm)
178 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
181 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
182 for model in $(MODELS); do \
183 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model PORTINCDIR=$(INCDIR)/mcs51 objects; \
187 model-mcs51-stack-auto:
188 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
189 for model in $(MODELS); do \
190 $(MAKE) MODELFLAGS="--model-$$model --stack-auto" PORT=$$model-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
194 model-mcs51-xstack-auto:
195 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
196 for model in $(MODELS); do \
197 $(MAKE) MODELFLAGS="--model-$$model --stack-auto --xstack" PORT=$$model-xstack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
202 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
203 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 PORTINCDIR=$(INCDIR)/mcs51 objects; \
207 if [ "`grep ds400 ../../ports.build`" = ds400 ]; then \
208 $(MAKE) MODELFLAGS="-mds400" PORT=ds400 PORTINCDIR=$(INCDIR)/mcs51 objects; \
212 if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
213 $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
216 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
217 cd $(PORTDIR); ls *$(OEXT) > lib$(PORT).lib
220 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
221 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
225 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
226 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
229 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects clean_intermediate
230 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
233 if [ "`grep hc08 ../../ports.build`" = hc08 ]; then \
234 $(MAKE) MODELFLAGS="-mhc08" PORT=hc08 objects-hc08; \
237 objects-hc08: build-dir $(HC08OBJECTS) port-specific-objects clean_intermediate
238 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
241 if [ "`grep pic16 ../../ports.build`" = pic16 ]; then \
242 $(MAKE) MODELFLAGS="-mpic16" PORT=pic16 OEXT=.lib objects-pic16; \
245 objects-pic16: build-dir port-specific-objects-pic16 clean_intermediate-pic16
246 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
249 build-dir: $(PORTDIR)
254 port-specific-objects:
255 if [ -d $(PORT) ]; then \
256 $(MAKE) -C $(PORT); \
257 cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
260 port-specific-objects-pic16:
261 if [ -d $(PORT) ]; then \
262 $(MAKE) -C $(PORT); \
263 cp -f $(PORT)/bin/*.* $(PORTDIR); \
270 rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
272 clean_intermediate-pic16:
273 $(MAKE) -C $(PORT) clean-intermediate
275 # Compiling and installing everything and runing test
276 # ---------------------------------------------------
277 install: all installdirs
278 cp -r -u $(BUILDDIR)/* $(sdcc_libdir)
279 cp -r -u ds390 ds400 gbz80 z80 hc08 *.c $(sdcc_libdir)/src
280 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'`
282 # Deleting all the installed files
283 # --------------------------------
285 rm -rf $(sdcc_libdir)
287 # Performing self-test
288 # --------------------
292 # Performing installation test
293 # ----------------------------
297 # Creating installation directories
298 # ---------------------------------
300 [ -d $(sdcc_libdir) ] || mkdir -p $(sdcc_libdir)
301 for model in $(MODELS); do \
302 [ -d $(sdcc_libdir)/$$model ] || \
303 mkdir -p $(sdcc_libdir)/$$model; \
305 [ -d $(sdcc_libdir)/ds390 ] || mkdir -p $(sdcc_libdir)/ds390
306 [ -d $(sdcc_libdir)/ds400 ] || mkdir -p $(sdcc_libdir)/ds400
307 [ -d $(sdcc_libdir)/hc08 ] || mkdir -p $(sdcc_libdir)/hc08
308 [ -d $(sdcc_libdir)/pic16 ] || mkdir -p $(sdcc_libdir)/pic16
309 mkdir -p $(sdcc_libdir)/src
311 # Creating dependencies
312 # ---------------------
315 Makefile.dep: $(SOURCES) $(INCDIR)/*.h $(PORTINCDIR)/*.h
317 for i in $(SOURCES); do \
318 $(CPP) -std=c99 -M $(CPPFLAGS) $$i >$${i}.dep; \
319 cat $${i}.dep >>Makefile.dep; \
331 $(PORTDIR)/%$(OEXT): %.c
332 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
334 # Remaking configuration
335 # ----------------------
337 @if [ -f $(PRJDIR)/devel ]; then\
338 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
342 # End of main_in.mk/main.mk