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 sdcc_datadir = @sdcc_datadir@
27 includedir = @includedir@
29 man1dir = $(mandir)/man1
30 man2dir = $(mandir)/man2
34 CPPFLAGS = -I$(INCDIR)
35 CFLAGS = $(MODELFLAGS) --nostdinc --nostdlib
40 PORTDIR = $(BUILDDIR)/$(PORT)
42 SOURCES = _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \
43 _decdptr.c _divsint.c _divslong.c _divuint.c \
44 _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
45 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
46 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
47 _fsneq.c _fssub.c _gptrget.c _gptrgetc.c _gptrput.c \
48 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
49 _islower.c _isprint.c _ispunct.c _isspace.c \
50 _isupper.c _isxdigit.c _itoa.c _ltoa.c \
51 _slong2fs.c _memcmp.c \
52 _memcpy.c _memset.c _modsint.c _modslong.c \
53 _moduint.c _modulong.c _mulint.c _mullong.c \
55 _spx.c _startup.c _strchr.c _strcmp.c _strcpy.c \
56 _strcspn.c _strlen.c _strncat.c _strncmp.c \
57 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
58 _strstr.c _strtok.c _uchar2fs.c _uint2fs.c \
59 _ulong2fs.c malloc.c serial.c ser_ir.c printfl.c \
60 printf_large.c vprintf.c puts.c gets.c \
61 assert.c _strcat.c time.c printf_fast.c bpx.c \
62 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
63 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
64 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
65 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c
67 OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
69 Z80SOURCES = _atoi.c \
70 _iscntrl.c _isdigit.c _isgraph.c \
71 _islower.c _isprint.c _ispunct.c _isspace.c \
72 _isupper.c _isxdigit.c _memcmp.c \
74 _startup.c _strchr.c _strcmp.c _strcpy.c \
75 _strcspn.c _strlen.c _strncat.c _strncmp.c \
76 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
80 _modslong.c _modulong.c \
82 _divslong.c _divulong.c \
84 _fs2schar.c _fs2sint.c _fs2slong.c \
85 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
86 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
88 _uchar2fs.c _uint2fs.c \
90 _slong2fs.c _sint2fs.c _schar2fs.c
92 Z80OBJECTS = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
94 XA51SOURCES = _atoi.c _atol.c _schar2fs.c \
95 _divsint.c _divslong.c _divuint.c \
96 _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
97 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
98 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
100 _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
101 _islower.c _isprint.c _ispunct.c _isspace.c \
102 _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
103 _memcpy.c _memset.c _modsint.c _modslong.c \
104 _moduint.c _modulong.c _mulint.c _mullong.c \
105 _strchr.c _strcmp.c _strcpy.c \
106 _strcspn.c _strlen.c _strncat.c _strncmp.c \
107 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
108 _strstr.c _strtok.c _uchar2fs.c _uint2fs.c \
109 _ulong2fs.c malloc.c puts.c gets.c \
110 printf_large.c puts.c gets.c \
111 assert.c _strcat.c time.c \
112 fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
113 cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
114 asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
115 sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c
117 XA51OBJECTS = $(XA51SOURCES:%.c=$(PORTDIR)/%.rel)
123 # Compiling entire program or any subproject
124 # ------------------------------------------
125 all: checkconf models model-ds390 model-z80 model-gbz80
127 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
130 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
131 for model in $(MODELS); do \
132 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
137 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
138 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
142 if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
143 $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
146 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
147 cd $(PORTDIR); ls *$(OEXT) > lib$(PORT).lib
150 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
151 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
155 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
156 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
159 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects clean_intermediate
160 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
162 build-dir: $(PORTDIR)
167 port-specific-objects:
168 if [ -d $(PORT) ]; then \
169 $(MAKE) -C $(PORT); \
170 cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
177 rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
179 # Compiling and installing everything and runing test
180 # ---------------------------------------------------
181 install: all installdirs
182 cp -r $(BUILDDIR)/* $(sdcc_datadir)/lib
183 cp -r ds390 gbz80 z80 *.c $(sdcc_datadir)/lib/src
184 rm `find $(sdcc_datadir)/lib/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm'`
186 # Deleting all the installed files
187 # --------------------------------
189 rm -rf $(sdcc_datadir)/lib
191 # Performing self-test
192 # --------------------
196 # Performing installation test
197 # ----------------------------
201 # Creating installation directories
202 # ---------------------------------
204 [ -d $(sdcc_datadir)/lib ] || mkdir -p $(sdcc_datadir)/lib
205 for model in $(MODELS); do \
206 [ -d $(sdcc_datadir)/lib/$$model ] || \
207 mkdir -p $(sdcc_datadir)/lib/$$model; \
209 [ -d $(sdcc_datadir)/lib/ds390 ] || mkdir -p $(sdcc_datadir)/lib/ds390
210 mkdir -p $(sdcc_datadir)/lib/src
212 # Creating dependencies
213 # ---------------------
216 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
218 for i in $(SOURCES); do \
219 $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
220 cat $${i}.dep >>Makefile.dep; \
232 $(PORTDIR)/%$(OEXT): %.c
233 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
235 # Remaking configuration
236 # ----------------------
238 @if [ -f $(PRJDIR)/devel ]; then\
239 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
243 # End of main_in.mk/main.mk