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 _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 _slong2fs.c _memcmp.c \
51 _memcpy.c _memset.c _modsint.c _modslong.c \
52 _moduint.c _modulong.c _mulint.c _mullong.c \
54 _spx.c _startup.c _strchr.c _strcmp.c _strcpy.c \
55 _strcspn.c _strlen.c _strncat.c _strncmp.c \
56 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
57 _strstr.c _strtok.c _uchar2fs.c _uint2fs.c \
58 _ulong2fs.c malloc.c serial.c ser_ir.c printfl.c \
59 printf_large.c vprintf.c puts.c gets.c \
60 assert.c _strcat.c time.c printf_fast.c
62 OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
64 Z80SOURCES = _atoi.c \
65 _iscntrl.c _isdigit.c _isgraph.c \
66 _islower.c _isprint.c _ispunct.c _isspace.c \
67 _isupper.c _isxdigit.c _memcmp.c \
69 _startup.c _strchr.c _strcmp.c _strcpy.c \
70 _strcspn.c _strlen.c _strncat.c _strncmp.c \
71 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
75 _modslong.c _modulong.c \
77 _divslong.c _divulong.c \
79 _fs2schar.c _fs2sint.c _fs2slong.c \
80 _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
81 _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
83 _uchar2fs.c _uint2fs.c \
85 _slong2fs.c _sint2fs.c _schar2fs.c
87 Z80OBJECTS = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
93 # Compiling entire program or any subproject
94 # ------------------------------------------
95 all: checkconf models model-ds390 model-z80 model-gbz80
97 objects: build-dir $(OBJECTS) port-specific-objects lib-files
100 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
101 for model in $(MODELS); do \
102 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
107 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
108 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
112 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
113 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
117 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
118 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
121 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects
122 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
124 build-dir: $(PORTDIR)
129 port-specific-objects:
130 if [ -d $(PORT) ]; then \
131 $(MAKE) -C $(PORT); \
132 cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
138 # Compiling and installing everything and runing test
139 # ---------------------------------------------------
140 install: all installdirs
141 cp -r $(BUILDDIR)/* $(sdcc_datadir)/lib
142 cp -r ds390 gbz80 z80 *.c $(sdcc_datadir)/lib/src
143 rm `find $(sdcc_datadir)/lib/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm'`
145 # Deleting all the installed files
146 # --------------------------------
148 for hdr in ../include/*.h; do rm -f $(sdcc_datadir)/include/$$hdr; done
149 for cfl in *.c; do rm -f $(sdcc_datadir)/lib/$$cfl; done
150 for model in $(MODELS); do \
151 rm -rf $(sdcc_datadir)/lib/$$model; \
153 rm -rf $(sdcc_datadir)/lib/ds390
156 # Performing self-test
157 # --------------------
161 # Performing installation test
162 # ----------------------------
166 # Creating installation directories
167 # ---------------------------------
169 [ -d $(sdcc_datadir)/lib ] || mkdir -p $(sdcc_datadir)/lib
170 for model in $(MODELS); do \
171 [ -d $(sdcc_datadir)/lib/$$model ] || \
172 mkdir -p $(sdcc_datadir)/lib/$$model; \
174 [ -d $(sdcc_datadir)/lib/ds390 ] || mkdir -p $(sdcc_datadir)/lib/ds390
175 mkdir -p $(sdcc_datadir)/lib/src
177 # Creating dependencies
178 # ---------------------
181 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
183 for i in $(SOURCES); do \
184 $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
185 cat $${i}.dep >>Makefile.dep; \
197 $(PORTDIR)/%$(OEXT): %.c
198 $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
199 mv -f `basename $@` $@
200 mv -f `basename $@ $(OEXT)`.asm $(PORTDIR)
202 # Remaking configuration
203 # ----------------------
205 @if [ -f $(PRJDIR)/devel ]; then\
206 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
210 # End of main_in.mk/main.mk