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 = $(DESTDIR)$(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 _fscmp.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 \
55 _memcmp.c _memcpy.c _memmove.c _memset.c \
56 _modsint.c _modslong.c _moduint.c _modulong.c \
57 _mulint.c _mullong.c \
60 _strcat.c _strchr.c _strcmp.c _strcpy.c \
61 _strcspn.c _strlen.c _strncat.c _strncmp.c \
62 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
64 _uchar2fs.c _uint2fs.c _ulong2fs.c \
65 calloc.c malloc.c realloc.c free.c \
66 serial.c ser_ir.c printfl.c \
67 printf_large.c sprintf.c vprintf.c puts.c gets.c \
68 printf_fast.c printf_fast_f.c printf_tiny.c \
69 assert.c time.c bpx.c \
70 _fsget1arg.c _fsget2args.c _fsnormalize.c \
71 _fsreturnval.c _fsrshift.c _fsswapargs.c _logexpf.c \
72 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
73 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
74 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
75 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
77 OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
79 Z80SOURCES = _atof.c _atoi.c \
80 _iscntrl.c _isdigit.c _isgraph.c \
81 _islower.c _isprint.c _ispunct.c _isspace.c \
82 _isupper.c _isxdigit.c \
83 _memcmp.c _memcpy.c _memmove.c _memset.c \
85 _strcat.c _strchr.c _strcmp.c _strcpy.c \
86 _strcspn.c _strlen.c _strncat.c _strncmp.c \
87 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
90 _modslong.c _modulong.c \
92 _divslong.c _divulong.c \
93 calloc.c malloc.c realloc.c free.c \
94 printf_large.c sprintf.c vprintf.c puts.c gets.c \
95 _fs2schar.c _fs2sint.c _fs2slong.c \
96 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
97 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
99 _uchar2fs.c _uint2fs.c \
101 _slong2fs.c _sint2fs.c _schar2fs.c
103 Z80OBJECTS = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
105 XA51SOURCES = _atof.c _atoi.c _atol.c _schar2fs.c \
106 _divsint.c _divslong.c _divuint.c \
107 _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
108 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
109 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
111 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
112 _islower.c _isprint.c _ispunct.c _isspace.c \
113 _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
114 _memcpy.c _memmove.c _memset.c _modsint.c _modslong.c \
115 _moduint.c _modulong.c _mulint.c _mullong.c \
116 _strcat.c _strchr.c _strcmp.c _strcpy.c \
117 _strcspn.c _strlen.c _strncat.c _strncmp.c \
118 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
119 _strstr.c _strtok.c \
120 _uchar2fs.c _uint2fs.c _ulong2fs.c \
121 calloc.c malloc.c realloc.c free.c \
123 printf_large.c puts.c gets.c \
125 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
126 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
127 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
128 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
130 XA51OBJECTS = $(XA51SOURCES:%.c=$(PORTDIR)/%.rel)
132 HC08SOURCES = _atof.c _atoi.c _atol.c _schar2fs.c \
133 _divsint.c _divslong.c \
134 _fs2schar.c _fs2sint.c _fs2slong.c \
135 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
136 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
138 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
139 _islower.c _isprint.c _ispunct.c _isspace.c \
140 _isupper.c _isxdigit.c _itoa.c _ltoa.c \
142 _memcmp.c _memcpy.c _memmove.c _memset.c \
143 _modsint.c _modslong.c _moduint.c _modulong.c \
145 _strcat.c _strchr.c _strcmp.c _strcpy.c \
146 _strcspn.c _strlen.c _strncat.c _strncmp.c \
147 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
148 _strstr.c _strtok.c \
149 _uchar2fs.c _uint2fs.c _ulong2fs.c \
150 calloc.c malloc.c realloc.c free.c \
151 printf_large.c sprintf.c vprintf.c \
153 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
154 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
155 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
156 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
158 HC08OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(HC08SOURCES))
164 # Compiling entire program or any subproject
165 # ------------------------------------------
166 all: checkconf models model-ds390 model-ds400 model-z80 model-gbz80 model-hc08
169 # (needs gputils curently not available of sourceforge's compile farm)
171 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
174 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
175 for model in $(MODELS); do \
176 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
180 model-mcs51-stack-auto:
181 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
182 for model in $(MODELS); do \
183 $(MAKE) MODELFLAGS="--model-$$model --stack-auto" PORT=$$model-stack-auto objects; \
187 model-mcs51-xstack-auto:
188 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
189 for model in $(MODELS); do \
190 $(MAKE) MODELFLAGS="--model-$$model --stack-auto --xstack" PORT=$$model-xstack-auto objects; \
195 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
196 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
200 if [ "`grep ds400 ../../ports.build`" = ds400 ]; then \
201 $(MAKE) MODELFLAGS="-mds400" PORT=ds400 objects; \
205 if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
206 $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
209 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
210 cd $(PORTDIR); ls *$(OEXT) > lib$(PORT).lib
213 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
214 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
218 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
219 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
222 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects clean_intermediate
223 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
226 if [ "`grep hc08 ../../ports.build`" = hc08 ]; then \
227 $(MAKE) MODELFLAGS="-mhc08" PORT=hc08 objects-hc08; \
230 objects-hc08: build-dir $(HC08OBJECTS) port-specific-objects clean_intermediate
231 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
234 if [ "`grep pic16 ../../ports.build`" = pic16 ]; then \
235 $(MAKE) MODELFLAGS="-mpic16" PORT=pic16 OEXT=.lib objects-pic16; \
238 objects-pic16: build-dir port-specific-objects-pic16 clean_intermediate-pic16
239 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
242 build-dir: $(PORTDIR)
247 port-specific-objects:
248 if [ -d $(PORT) ]; then \
249 $(MAKE) -C $(PORT); \
250 cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
253 port-specific-objects-pic16:
254 if [ -d $(PORT) ]; then \
255 $(MAKE) -C $(PORT); \
256 cp -f $(PORT)/bin/*.* $(PORTDIR); \
263 rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
265 clean_intermediate-pic16:
266 $(MAKE) -C $(PORT) clean-intermediate
268 # Compiling and installing everything and runing test
269 # ---------------------------------------------------
270 install: all installdirs
271 cp -r -u $(BUILDDIR)/* $(sdcc_libdir)
272 cp -r -u ds390 ds400 gbz80 z80 hc08 *.c $(sdcc_libdir)/src
273 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'`
275 # Deleting all the installed files
276 # --------------------------------
278 rm -rf $(sdcc_libdir)
280 # Performing self-test
281 # --------------------
285 # Performing installation test
286 # ----------------------------
290 # Creating installation directories
291 # ---------------------------------
293 [ -d $(sdcc_libdir) ] || mkdir -p $(sdcc_libdir)
294 for model in $(MODELS); do \
295 [ -d $(sdcc_libdir)/$$model ] || \
296 mkdir -p $(sdcc_libdir)/$$model; \
298 [ -d $(sdcc_libdir)/ds390 ] || mkdir -p $(sdcc_libdir)/ds390
299 [ -d $(sdcc_libdir)/ds400 ] || mkdir -p $(sdcc_libdir)/ds400
300 [ -d $(sdcc_libdir)/hc08 ] || mkdir -p $(sdcc_libdir)/hc08
301 [ -d $(sdcc_libdir)/pic16 ] || mkdir -p $(sdcc_libdir)/pic16
302 mkdir -p $(sdcc_libdir)/src
304 # Creating dependencies
305 # ---------------------
308 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
310 for i in $(SOURCES); do \
311 $(CPP) -std=c99 -M $(CPPFLAGS) $$i >$${i}.dep; \
312 cat $${i}.dep >>Makefile.dep; \
324 $(PORTDIR)/%$(OEXT): %.c
325 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
327 # Remaking configuration
328 # ----------------------
330 @if [ -f $(PRJDIR)/devel ]; then\
331 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
335 # End of main_in.mk/main.mk