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 _mulsint.c _muluint.c \
53 _mululong.c _mulslong.c _ser.c _setjmp.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 \
63 OBJECTS = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
65 Z80SOURCES = _atoi.c \
66 _iscntrl.c _isdigit.c _isgraph.c \
67 _islower.c _isprint.c _ispunct.c _isspace.c \
68 _isupper.c _isxdigit.c _memcmp.c \
70 _startup.c _strchr.c _strcmp.c _strcpy.c \
71 _strcspn.c _strlen.c _strncat.c _strncmp.c \
72 _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
76 _modslong.c _modulong.c \
78 _divslong.c _divulong.c
80 Z80OBJECTS = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
86 # Compiling entire program or any subproject
87 # ------------------------------------------
88 all: checkconf models model-ds390 model-z80 model-gbz80
90 objects: build-dir $(OBJECTS) port-specific-objects lib-files
93 if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
94 for model in $(MODELS); do \
95 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
100 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
101 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
105 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
106 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
110 if [ "`grep z80 ../../ports.build`" = z80 ]; then \
111 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
114 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects
115 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
117 build-dir: $(PORTDIR)
122 port-specific-objects:
123 if [ -d $(PORT) ]; then \
124 $(MAKE) -C $(PORT); \
125 cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
131 # Compiling and installing everything and runing test
132 # ---------------------------------------------------
133 install: all installdirs
134 cp -r $(BUILDDIR)/* $(sdcc_datadir)/lib
135 cp -r ds390 gbz80 z80 *.c $(sdcc_datadir)/lib/src
136 rm `find $(sdcc_datadir)/lib/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm'`
138 # Deleting all the installed files
139 # --------------------------------
141 for hdr in ../include/*.h; do rm -f $(sdcc_datadir)/include/$$hdr; done
142 for cfl in *.c; do rm -f $(sdcc_datadir)/lib/$$cfl; done
143 for model in $(MODELS); do \
144 rm -rf $(sdcc_datadir)/lib/$$model; \
146 rm -rf $(sdcc_datadir)/lib/ds390
149 # Performing self-test
150 # --------------------
154 # Performing installation test
155 # ----------------------------
159 # Creating installation directories
160 # ---------------------------------
162 [ -d $(sdcc_datadir)/lib ] || mkdir -p $(sdcc_datadir)/lib
163 for model in $(MODELS); do \
164 [ -d $(sdcc_datadir)/lib/$$model ] || \
165 mkdir -p $(sdcc_datadir)/lib/$$model; \
167 [ -d $(sdcc_datadir)/lib/ds390 ] || mkdir -p $(sdcc_datadir)/lib/ds390
168 mkdir -p $(sdcc_datadir)/lib/src
170 # Creating dependencies
171 # ---------------------
174 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
176 for i in $(SOURCES); do \
177 $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
178 cat $${i}.dep >>Makefile.dep; \
190 $(PORTDIR)/%$(OEXT): %.c
191 $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
192 mv -f `basename $@` $@
193 mv -f `basename $@ $(OEXT)`.asm $(PORTDIR)
195 # Remaking configuration
196 # ----------------------
198 @if [ -f $(PRJDIR)/devel ]; then\
199 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
203 # End of main_in.mk/main.mk