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 \
77 _mulslong.c _mululong.c _mulint.c _mullong.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 for model in $(MODELS); do \
94 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
98 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
99 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
103 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o
106 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o
108 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects
109 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
111 build-dir: $(PORTDIR)
116 port-specific-objects:
117 if [ -d $(PORT) ]; then \
118 $(MAKE) -C $(PORT); \
119 cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
125 # Compiling and installing everything and runing test
126 # ---------------------------------------------------
127 install: all installdirs
128 cp -r $(BUILDDIR)/* $(sdcc_datadir)/lib
129 cp -r ds390 gbz80 z80 *.c $(sdcc_datadir)/lib/src
130 rm `find $(sdcc_datadir)/lib/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm'`
132 # Deleting all the installed files
133 # --------------------------------
135 for hdr in ../include/*.h; do rm -f $(sdcc_datadir)/include/$$hdr; done
136 for cfl in *.c; do rm -f $(sdcc_datadir)/lib/$$cfl; done
137 for model in $(MODELS); do \
138 rm -rf $(sdcc_datadir)/lib/$$model; \
140 rm -rf $(sdcc_datadir)/lib/ds390
143 # Performing self-test
144 # --------------------
148 # Performing installation test
149 # ----------------------------
153 # Creating installation directories
154 # ---------------------------------
156 [ -d $(sdcc_datadir)/lib ] || mkdir -p $(sdcc_datadir)/lib
157 for model in $(MODELS); do \
158 [ -d $(sdcc_datadir)/lib/$$model ] || \
159 mkdir -p $(sdcc_datadir)/lib/$$model; \
161 [ -d $(sdcc_datadir)/lib/ds390 ] || mkdir -p $(sdcc_datadir)/lib/ds390
162 mkdir -p $(sdcc_datadir)/lib/src
164 # Creating dependencies
165 # ---------------------
168 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
170 for i in $(SOURCES); do \
171 $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
172 cat $${i}.dep >>Makefile.dep; \
184 $(PORTDIR)/%$(OEXT): %.c
185 $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
186 mv -f `basename $@` $@
187 mv -f `basename $@ $(OEXT)`.asm $(PORTDIR)
189 # Remaking configuration
190 # ----------------------
192 @if [ -f $(PRJDIR)/devel ]; then\
193 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
197 # End of main_in.mk/main.mk