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
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 \
76 _mulslong.c _mululong.c \
77 _divslong.c _divulong.c
79 Z80OBJECTS = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
85 # Compiling entire program or any subproject
86 # ------------------------------------------
87 all: checkconf models model-ds390 model-z80 model-gbz80
89 objects: build-dir $(OBJECTS) port-specific-objects lib-files
92 for model in $(MODELS); do \
93 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
97 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
98 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
102 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o
105 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o
107 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects
108 cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
110 build-dir: $(PORTDIR)
115 port-specific-objects:
116 if [ -d $(PORT) ]; then \
117 $(MAKE) -C $(PORT); \
118 cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
124 # Compiling and installing everything and runing test
125 # ---------------------------------------------------
126 install: all installdirs
127 cp -r $(BUILDDIR)/* $(sdcc_datadir)/lib
128 cp -r ds390 gbz80 z80 *.c $(sdcc_datadir)/lib/src
129 rm `find $(sdcc_datadir)/lib/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm'`
131 # Deleting all the installed files
132 # --------------------------------
134 for hdr in ../include/*.h; do rm -f $(sdcc_datadir)/include/$$hdr; done
135 for cfl in *.c; do rm -f $(sdcc_datadir)/lib/$$cfl; done
136 for model in $(MODELS); do \
137 rm -rf $(sdcc_datadir)/lib/$$model; \
139 rm -rf $(sdcc_datadir)/lib/ds390
142 # Performing self-test
143 # --------------------
147 # Performing installation test
148 # ----------------------------
152 # Creating installation directories
153 # ---------------------------------
155 [ -d $(sdcc_datadir)/lib ] || mkdir -p $(sdcc_datadir)/lib
156 for model in $(MODELS); do \
157 [ -d $(sdcc_datadir)/lib/$$model ] || \
158 mkdir -p $(sdcc_datadir)/lib/$$model; \
160 [ -d $(sdcc_datadir)/lib/ds390 ] || mkdir -p $(sdcc_datadir)/lib/ds390
161 mkdir -p $(sdcc_datadir)/lib/src
163 # Creating dependencies
164 # ---------------------
167 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
169 for i in $(SOURCES); do \
170 $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
171 cat $${i}.dep >>Makefile.dep; \
183 $(PORTDIR)/%$(OEXT): %.c
184 $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
185 mv -f `basename $@` $@
186 mv -f `basename $@ $(OEXT)`.asm $(PORTDIR)
188 # Remaking configuration
189 # ----------------------
191 @if [ -f $(PRJDIR)/devel ]; then\
192 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
196 # End of main_in.mk/main.mk