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 --nostdlib
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 _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 \
61 _strstr.c _strtok.c _uchar2fs.c _uint2fs.c \
62 _ulong2fs.c malloc.c serial.c ser_ir.c printfl.c \
63 printf_large.c vprintf.c puts.c gets.c \
64 assert.c _strcat.c time.c printf_fast.c bpx.c \
65 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
66 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
67 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
68 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c
70 OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
72 Z80SOURCES = _atof.c _atoi.c \
73 _iscntrl.c _isdigit.c _isgraph.c \
74 _islower.c _isprint.c _ispunct.c _isspace.c \
75 _isupper.c _isxdigit.c _memcmp.c \
77 _startup.c _strchr.c _strcmp.c _strcpy.c \
78 _strcspn.c _strlen.c _strncat.c _strncmp.c \
79 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
83 _modsint.c _moduint.c \
84 _modslong.c _modulong.c \
87 _divsint.c _divuint.c \
88 _divslong.c _divulong.c \
90 _fs2schar.c _fs2sint.c _fs2slong.c \
91 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
92 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
94 _uchar2fs.c _uint2fs.c \
96 _slong2fs.c _sint2fs.c _schar2fs.c
98 Z80OBJECTS = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
100 XA51SOURCES = _atof.c _atoi.c _atol.c _schar2fs.c \
101 _divsint.c _divslong.c _divuint.c \
102 _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
103 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
104 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
106 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
107 _islower.c _isprint.c _ispunct.c _isspace.c \
108 _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
109 _memcpy.c _memset.c _modsint.c _modslong.c \
110 _moduint.c _modulong.c _mulint.c _mullong.c \
111 _strchr.c _strcmp.c _strcpy.c \
112 _strcspn.c _strlen.c _strncat.c _strncmp.c \
113 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
114 _strstr.c _strtok.c _uchar2fs.c _uint2fs.c \
115 _ulong2fs.c malloc.c puts.c gets.c \
116 printf_large.c puts.c gets.c \
117 assert.c _strcat.c time.c \
118 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
119 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
120 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
121 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c
123 XA51OBJECTS = $(XA51SOURCES:%.c=$(PORTDIR)/%.rel)
129 # Compiling entire program or any subproject
130 # ------------------------------------------
131 all: checkconf models model-ds390 model-ds400 model-z80 model-gbz80
133 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
136 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
137 for model in $(MODELS); do \
138 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
143 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
144 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
148 if [ "`grep ds400 ../../ports.build`" = ds400 ]; then \
149 $(MAKE) MODELFLAGS="-mds400" PORT=ds400 objects; \
153 if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
154 $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
157 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
158 cd $(PORTDIR); ls *$(OEXT) > lib$(PORT).lib
161 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
162 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
166 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
167 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
170 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects clean_intermediate
171 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
173 build-dir: $(PORTDIR)
178 port-specific-objects:
179 if [ -d $(PORT) ]; then \
180 $(MAKE) -C $(PORT); \
181 cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
188 rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
190 # Compiling and installing everything and runing test
191 # ---------------------------------------------------
192 install: all installdirs
193 cp -r $(BUILDDIR)/* $(sdcc_libdir)
194 cp -r ds390 ds400 gbz80 z80 *.c $(sdcc_libdir)/src
195 rm `find $(sdcc_libdir)/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm'`
197 # Deleting all the installed files
198 # --------------------------------
200 rm -rf $(sdcc_libdir)
202 # Performing self-test
203 # --------------------
207 # Performing installation test
208 # ----------------------------
212 # Creating installation directories
213 # ---------------------------------
215 [ -d $(sdcc_libdir) ] || mkdir -p $(sdcc_libdir)
216 for model in $(MODELS); do \
217 [ -d $(sdcc_libdir)/$$model ] || \
218 mkdir -p $(sdcc_libdir)/$$model; \
220 [ -d $(sdcc_libdir)/ds390 ] || mkdir -p $(sdcc_libdir)/ds390
221 [ -d $(sdcc_libdir)/ds400 ] || mkdir -p $(sdcc_libdir)/ds400
222 mkdir -p $(sdcc_libdir)/src
224 # Creating dependencies
225 # ---------------------
228 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
230 for i in $(SOURCES); do \
231 $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
232 cat $${i}.dep >>Makefile.dep; \
244 $(PORTDIR)/%$(OEXT): %.c
245 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
247 # Remaking configuration
248 # ----------------------
250 @if [ -f $(PRJDIR)/devel ]; then\
251 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
255 # End of main_in.mk/main.mk