minor xa51 improvements
[fw/sdcc] / device / lib / Makefile.in
1 #
2 #
3 #
4
5 VERSION         = @VERSION@
6 VERSIONHI       = @VERSIONHI@
7 VERSIONLO       = @VERSIONLO@
8 VERSIONP        = @VERSIONP@
9
10 SHELL           = /bin/sh
11 CPP             = @CPP@
12 INSTALL         = @INSTALL@
13 CP              = @CP@
14
15 PRJDIR          = ../..
16 INCDIR          = $(PRJDIR)/device/include
17
18 CC              = $(PRJDIR)/bin/sdcc
19 CPP             = $(PRJDIR)/bin/sdcpp
20
21 prefix          = @prefix@
22 exec_prefix     = @exec_prefix@
23 bindir          = @bindir@
24 libdir          = @libdir@
25 datadir         = @datadir@
26 sdcc_datadir    = @sdcc_datadir@
27 includedir      = @includedir@
28 mandir          = @mandir@
29 man1dir         = $(mandir)/man1
30 man2dir         = $(mandir)/man2
31 infodir         = @infodir@
32 srcdir          = @srcdir@
33
34 CPPFLAGS        = -I$(INCDIR)
35 CFLAGS          = $(MODELFLAGS) --nostdinc --nostdlib
36
37 BUILDDIR        = build
38 # Default
39 PORT            = z80
40 PORTDIR         = $(BUILDDIR)/$(PORT)
41
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 _gptrgetc.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 \
53                   _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 bpx.c \
61                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
62                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
63                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
64                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c
65
66 OBJECTS         = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
67
68 Z80SOURCES      = _atoi.c \
69                   _iscntrl.c _isdigit.c _isgraph.c \
70                   _islower.c _isprint.c _ispunct.c _isspace.c \
71                   _isupper.c _isxdigit.c _memcmp.c \
72                   _memcpy.c _memset.c \
73                   _startup.c _strchr.c _strcmp.c _strcpy.c \
74                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
75                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
76                   _strstr.c _strtok.c \
77                   puts.c gets.c \
78                   assert.c _strcat.c \
79                   _modslong.c _modulong.c \
80                   _mullong.c \
81                   _divslong.c _divulong.c \
82                   malloc.c \
83                   _fs2schar.c _fs2sint.c _fs2slong.c \
84                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
85                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
86                   _fsneq.c _fssub.c \
87                   _uchar2fs.c _uint2fs.c \
88                   _ulong2fs.c \
89                   _slong2fs.c _sint2fs.c _schar2fs.c 
90
91 Z80OBJECTS      = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
92
93 XA51SOURCES      = _atoi.c _atol.c _schar2fs.c \
94                   _divsint.c _divslong.c _divuint.c \
95                   _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
96                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
97                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
98                   _fsneq.c _fssub.c \
99                   _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
100                   _islower.c _isprint.c _ispunct.c _isspace.c \
101                   _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
102                   _memcpy.c _memset.c _modsint.c _modslong.c \
103                   _moduint.c _modulong.c _mulint.c _mullong.c \
104                   _strchr.c _strcmp.c _strcpy.c \
105                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
106                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
107                   _strstr.c _strtok.c _uchar2fs.c _uint2fs.c \
108                   _ulong2fs.c malloc.c puts.c gets.c \
109                   assert.c _strcat.c time.c \
110                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
111                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
112                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
113                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c
114
115 XA51OBJECTS      = $(XA51SOURCES:%.c=$(PORTDIR)/%.xa)
116
117 OEXT            = .rel
118
119 include incl.mk
120
121 # Compiling entire program or any subproject
122 # ------------------------------------------
123 all: checkconf models model-ds390 model-z80 model-gbz80
124
125 objects: build-dir $(OBJECTS) port-specific-objects lib-files
126
127 models:
128         if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
129           for model in $(MODELS); do \
130             $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model objects; \
131           done \
132         fi
133
134 model-ds390:
135         if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
136           $(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
137         fi
138
139 model-xa51:
140         if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
141           $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51 OEXT=.xa; \
142         fi
143
144 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
145         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
146
147 model-z80:
148         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
149           $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
150         fi
151
152 model-gbz80:
153         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
154           $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
155         fi
156
157 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects
158         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
159
160 build-dir: $(PORTDIR)
161
162 $(PORTDIR):
163         mkdir -p $(PORTDIR)
164
165 port-specific-objects:
166         if [ -d $(PORT) ]; then \
167           $(MAKE) -C $(PORT); \
168           cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
169         fi
170
171 lib-files:
172         cp *.lib $(PORTDIR)
173
174 # Compiling and installing everything and runing test
175 # ---------------------------------------------------
176 install: all installdirs
177         cp -r $(BUILDDIR)/* $(sdcc_datadir)/lib
178         cp -r ds390 gbz80 z80 *.c $(sdcc_datadir)/lib/src
179         rm `find $(sdcc_datadir)/lib/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm'`
180
181 # Deleting all the installed files
182 # --------------------------------
183 uninstall:
184         for hdr in ../include/*.h; do rm -f $(sdcc_datadir)/include/$$hdr; done
185         for cfl in *.c; do rm -f $(sdcc_datadir)/lib/$$cfl; done
186         for model in $(MODELS); do \
187           rm -rf $(sdcc_datadir)/lib/$$model; \
188         done
189         rm -rf $(sdcc_datadir)/lib/ds390
190
191
192 # Performing self-test
193 # --------------------
194 check:
195
196
197 # Performing installation test
198 # ----------------------------
199 installcheck:
200
201
202 # Creating installation directories
203 # ---------------------------------
204 installdirs:
205         [ -d $(sdcc_datadir)/lib ] || mkdir -p $(sdcc_datadir)/lib
206         for model in $(MODELS); do \
207          [ -d $(sdcc_datadir)/lib/$$model ] || \
208          mkdir -p $(sdcc_datadir)/lib/$$model; \
209         done
210         [ -d $(sdcc_datadir)/lib/ds390 ] || mkdir -p $(sdcc_datadir)/lib/ds390
211         mkdir -p $(sdcc_datadir)/lib/src
212
213 # Creating dependencies
214 # ---------------------
215 dep: Makefile.dep
216
217 Makefile.dep: $(SOURCES) $(INCDIR)/*.h
218         rm -f Makefile.dep
219         for i in $(SOURCES); do \
220           $(CPP) -lang-c++ -M $(CPPFLAGS) $$i >$${i}.dep; \
221           cat $${i}.dep >>Makefile.dep; \
222           rm $${i}.dep; \
223         done
224
225 include Makefile.dep
226 include clean.mk
227
228 # My rules
229 # --------
230
231 .SUFFIXES: .rel .o
232
233 $(PORTDIR)/%$(OEXT): %.c
234         $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
235         mv -f `basename $@` $@
236         -mv -f `basename $@ $(OEXT)`.asm $(PORTDIR)
237
238 # Remaking configuration
239 # ----------------------
240 checkconf:
241         @if [ -f $(PRJDIR)/devel ]; then\
242           $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
243           freshconf;\
244         fi
245
246 # End of main_in.mk/main.mk