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)
37 OBJECTS = _atoi.rel _atol.rel _autobaud.rel _bp.rel _schar2fs.rel \
38 _decdptr.rel _divsint.rel _divslong.rel _divuint.rel \
39 _divulong.rel _fs2schar.rel _fs2sint.rel _fs2slong.rel \
40 _fs2uchar.rel _fs2uint.rel _fs2ulong.rel _fsadd.rel \
41 _fsdiv.rel _fseq.rel _fsgt.rel _fslt.rel _fsmul.rel \
42 _fsneq.rel _fssub.rel _gptrget.rel _gptrput.rel \
43 _sint2fs.rel _iscntrl.rel _isdigit.rel _isgraph.rel \
44 _islower.rel _isprint.rel _ispunct.rel _isspace.rel \
45 _isupper.rel _isxdigit.rel _slong2fs.rel _memcmp.rel \
46 _memcpy.rel _memset.rel _modsint.rel _modslong.rel \
47 _moduint.rel _modulong.rel _mulsint.rel _muluint.rel \
48 _mululong.rel _mulslong.rel _ser.rel _setjmp.rel \
49 _spx.rel _startup.rel _strchr.rel _strcmp.rel _strcpy.rel \
50 _strcspn.rel _strlen.rel _strncat.rel _strncmp.rel \
51 _strncpy.rel _strpbrk.rel _strrchr.rel _strspn.rel \
52 _strstr.rel _strtok.rel _uchar2fs.rel _uint2fs.rel \
53 _ulong2fs.rel malloc.rel serial.rel ser_ir.rel printfl.rel \
54 printf_large.rel vprintf.rel puts.rel gets.rel \
55 assert.rel _strcat.rel time.rel
56 SOURCES = $(patsubst %.rel,%.c,$(OBJECTS))
60 # Compiling entire program or any subproject
61 # ------------------------------------------
62 all: checkconf models modelDS390
67 for model in $(MODELS); do \
68 test -d $$model || mkdir $$model; \
69 $(MAKE) CFLAGS="$(CFLAGS) --model-$$model" objects; \
75 if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
76 test -d ds390 || mkdir ds390; \
78 $(MAKE) CFLAGS="$(CFLAGS) -mds390" objects; \
79 cd ds390; $(MAKE); cd ..; \
81 mv *.rel *.asm ds390; \
84 # Compiling and installing everything and runing test
85 # ---------------------------------------------------
87 $(CP) *.c $(sdcc_datadir)/lib/
88 for model in $(MODELS); do \
89 [ -d $$model ] || $(MAKE) all; \
90 $(CP) $$model/*.rel *.lib $(sdcc_datadir)/lib/$$model/; \
91 $(CP) $$model/*.asm $(sdcc_datadir)/lib/$$model/; \
94 installDS390: installdirs
95 $(CP) ds390/*.lib ds390/*.rel ds390/*.asm $(sdcc_datadir)/lib/ds390
97 # Deleting all the installed files
98 # --------------------------------
100 for hdr in ../include/*.h; do rm -f $(sdcc_datadir)/include/$$hdr; done
101 for cfl in *.c; do rm -f $(sdcc_datadir)/lib/$$cfl; done
102 for model in $(MODELS); do \
103 rm -rf $(sdcc_datadir)/lib/$$model; \
105 rm -rf $(sdcc_datadir)/lib/ds390
108 # Performing self-test
109 # --------------------
113 # Performing installation test
114 # ----------------------------
118 # Creating installation directories
119 # ---------------------------------
121 [ -d $(sdcc_datadir)/lib ] || mkdir -p $(sdcc_datadir)/lib
122 for model in $(MODELS); do \
123 [ -d $(sdcc_datadir)/lib/$$model ] || \
124 mkdir -p $(sdcc_datadir)/lib/$$model; \
126 [ -d $(sdcc_datadir)/lib/ds390 ] || mkdir -p $(sdcc_datadir)/lib/ds390
128 # Creating dependencies
129 # ---------------------
132 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
134 for i in $(SOURCES); do \
135 $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
136 cat $${i}.dep >>Makefile.dep; \
149 $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
152 # Remaking configuration
153 # ----------------------
155 @if [ -f $(PRJDIR)/devel ]; then\
156 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
160 # End of main_in.mk/main.mk