* device/lib/Makefile.in (port-specific-objects-pic16):
[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 ifndef PORTINCDIR
18 PORTINCDIR      = $(INCDIR)/mcs51
19 endif
20
21 CC              = $(PRJDIR)/bin/sdcc
22 CPP             = $(PRJDIR)/bin/sdcpp
23
24 prefix          = @prefix@
25 exec_prefix     = @exec_prefix@
26 bindir          = @bindir@
27 libdir          = @libdir@
28 datadir         = @datadir@
29 includedir      = @includedir@
30 mandir          = @mandir@
31 man1dir         = $(mandir)/man1
32 man2dir         = $(mandir)/man2
33 infodir         = @infodir@
34 srcdir          = @srcdir@
35
36 lib_dir_suffix  = @lib_dir_suffix@
37
38 sdcc_libdir     = $(DESTDIR)$(datadir)/$(lib_dir_suffix)
39
40 CPPFLAGS        = -I$(INCDIR) -I$(PORTINCDIR)
41 CFLAGS          = $(MODELFLAGS) --nostdinc
42
43 BUILDDIR        = build
44 # Default
45 PORT            = z80
46 PORTDIR         = $(BUILDDIR)/$(PORT)
47
48 SOURCES         = _atof.c _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \
49                   _decdptr.c _divsint.c _divslong.c _divuint.c \
50                   _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
51                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
52                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fscmp.c _fsmul.c \
53                   _fsneq.c _fssub.c _gptrget.c _gptrgetc.c _gptrput.c \
54                   _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
55                   _islower.c _isprint.c _ispunct.c _isspace.c \
56                   _isupper.c _isxdigit.c _itoa.c _ltoa.c \
57                   _slong2fs.c \
58                   _memcmp.c _memcpy.c _memmove.c _memset.c \
59                   _modsint.c _modslong.c _moduint.c _modulong.c \
60                   _mulint.c _mullong.c \
61                   abs.c labs.c \
62                   _ser.c _setjmp.c \
63                   _spx.c _startup.c \
64                   _strcat.c _strchr.c _strcmp.c _strcpy.c \
65                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
66                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
67                   _strstr.c _strtok.c \
68                   _uchar2fs.c _uint2fs.c _ulong2fs.c \
69                   calloc.c malloc.c realloc.c free.c \
70                   serial.c ser_ir.c printfl.c \
71                   printf_large.c sprintf.c vprintf.c puts.c gets.c \
72                   printf_fast.c printf_fast_f.c printf_tiny.c \
73                   assert.c time.c bpx.c \
74                   _fsget1arg.c _fsget2args.c _fsnormalize.c \
75                   _fsreturnval.c _fsrshift.c _fsswapargs.c _logexpf.c \
76                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
77                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
78                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
79                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
80
81 OBJECTS         = $(patsubst %.c,$(PORTDIR)/%.rel,$(SOURCES))
82
83 Z80SOURCES      = _atof.c _atoi.c \
84                   _iscntrl.c _isdigit.c _isgraph.c \
85                   _islower.c _isprint.c _ispunct.c _isspace.c \
86                   _isupper.c _isxdigit.c \
87                   _memcmp.c _memcpy.c _memmove.c _memset.c \
88                   _startup.c \
89                   _strcat.c _strchr.c _strcmp.c _strcpy.c \
90                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
91                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
92                   _strstr.c _strtok.c \
93                   assert.c \
94                   _modslong.c _modulong.c \
95                   _mullong.c \
96                   abs.c labs.c \
97                   _divslong.c _divulong.c \
98                   calloc.c malloc.c realloc.c free.c \
99                   printf_large.c sprintf.c vprintf.c puts.c gets.c \
100                   _fs2schar.c _fs2sint.c _fs2slong.c \
101                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
102                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
103                   _fsneq.c _fssub.c \
104                   _uchar2fs.c _uint2fs.c \
105                   _ulong2fs.c \
106                   _slong2fs.c _sint2fs.c _schar2fs.c
107
108 Z80OBJECTS      = $(Z80SOURCES:%.c=$(PORTDIR)/%.o)
109
110 XA51SOURCES      = _atof.c _atoi.c _atol.c _schar2fs.c \
111                   _divsint.c _divslong.c _divuint.c \
112                   _divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
113                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
114                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
115                   _fsneq.c _fssub.c \
116                   _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
117                   _islower.c _isprint.c _ispunct.c _isspace.c \
118                   _isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
119                   _memcpy.c _memmove.c _memset.c _modsint.c _modslong.c \
120                   _moduint.c _modulong.c _mulint.c _mullong.c \
121                   abs.c labs.c \
122                   _strcat.c _strchr.c _strcmp.c _strcpy.c \
123                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
124                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
125                   _strstr.c _strtok.c \
126                   _uchar2fs.c _uint2fs.c _ulong2fs.c \
127                   calloc.c malloc.c realloc.c free.c \
128                   puts.c gets.c \
129                   printf_large.c puts.c gets.c \
130                   assert.c time.c \
131                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
132                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
133                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
134                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
135
136 XA51OBJECTS      = $(XA51SOURCES:%.c=$(PORTDIR)/%.rel)
137
138 HC08SOURCES     = _atof.c _atoi.c _atol.c _schar2fs.c \
139                   _divsint.c _divslong.c \
140                   _fs2schar.c _fs2sint.c _fs2slong.c \
141                   _fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
142                   _fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
143                   _fsneq.c _fssub.c \
144                   _sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
145                   _islower.c _isprint.c _ispunct.c _isspace.c \
146                   _isupper.c _isxdigit.c _itoa.c _ltoa.c \
147                   _slong2fs.c \
148                   _memcmp.c _memcpy.c _memmove.c _memset.c \
149                   _modsint.c _modslong.c _moduint.c _modulong.c \
150                   abs.c labs.c \
151                   _spx.c _startup.c \
152                   _strcat.c _strchr.c _strcmp.c _strcpy.c \
153                   _strcspn.c _strlen.c _strncat.c _strncmp.c \
154                   _strncpy.c _strpbrk.c _strrchr.c _strspn.c \
155                   _strstr.c _strtok.c \
156                   _uchar2fs.c _uint2fs.c _ulong2fs.c \
157                   calloc.c malloc.c realloc.c free.c \
158                   printf_large.c sprintf.c vprintf.c \
159                   assert.c time.c \
160                   fabsf.c frexpf.c ldexpf.c expf.c powf.c sincosf.c sinf.c \
161                   cosf.c logf.c log10f.c sqrtf.c tancotf.c tanf.c cotf.c \
162                   asincosf.c asinf.c acosf.c atanf.c atan2f.c sincoshf.c \
163                   sinhf.c coshf.c tanhf.c floorf.c ceilf.c modff.c errno.c
164
165 HC08OBJECTS     = $(patsubst %.c,$(PORTDIR)/%.rel,$(HC08SOURCES))
166
167 OEXT            = .rel
168
169 include incl.mk
170
171 # Compiling entire program or any subproject
172 # ------------------------------------------
173 all: checkconf models model-ds390 model-ds400 model-z80 model-gbz80 model-hc08 model-pic16
174
175 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
176
177 models:
178         if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
179           for model in $(MODELS); do \
180             $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model PORTINCDIR=$(INCDIR)/mcs51 objects; \
181           done \
182         fi
183
184 model-mcs51-stack-auto:
185         if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
186           for model in $(MODELS); do \
187             $(MAKE) MODELFLAGS="--model-$$model --stack-auto" PORT=$$model-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
188           done \
189         fi
190
191 model-mcs51-xstack-auto:
192         if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
193           for model in $(MODELS); do \
194             $(MAKE) MODELFLAGS="--model-$$model --stack-auto --xstack" PORT=$$model-xstack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
195           done \
196         fi
197
198 model-ds390:
199         if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
200           $(MAKE) MODELFLAGS="-mds390" PORT=ds390 PORTINCDIR=$(INCDIR)/mcs51 objects; \
201         fi
202
203 model-ds400:
204         if [ "`grep ds400 ../../ports.build`" = ds400 ]; then \
205           $(MAKE) MODELFLAGS="-mds400" PORT=ds400 PORTINCDIR=$(INCDIR)/mcs51 objects; \
206         fi
207
208 model-xa51:
209         if [ "`grep xa51 ../../ports.build`" = xa51 ]; then \
210           $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
211         fi
212
213 objects-xa51: build-dir $(XA51OBJECTS) port-specific-objects
214         cd $(PORTDIR); ls *$(OEXT) > lib$(PORT).lib
215
216 model-z80:
217         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
218           $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
219         fi
220
221 model-gbz80:
222         if [ "`grep z80 ../../ports.build`" = z80 ]; then \
223           $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
224         fi
225
226 objects-z80: build-dir $(Z80OBJECTS) port-specific-objects clean_intermediate
227         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
228
229 model-hc08:
230         if [ "`grep hc08 ../../ports.build`" = hc08 ]; then \
231           $(MAKE) MODELFLAGS="-mhc08" PORT=hc08 objects-hc08; \
232         fi
233
234 objects-hc08: build-dir $(HC08OBJECTS) port-specific-objects clean_intermediate
235         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
236
237 model-pic16:
238         if [ "`grep pic16 ../../ports.build`" = pic16 ]; then \
239           $(MAKE) MODELFLAGS="-mpic16" PORT=pic16 OEXT=.lib objects-pic16; \
240         fi
241
242 objects-pic16: build-dir port-specific-objects-pic16 clean_intermediate-pic16
243         cd $(PORTDIR); ls *$(OEXT) > $(PORT).lib
244
245
246 build-dir: $(PORTDIR)
247
248 $(PORTDIR):
249         mkdir -p $(PORTDIR)
250
251 port-specific-objects:
252         if [ -d $(PORT) ]; then \
253           $(MAKE) -C $(PORT); \
254           cp -f $(PORT)/*.lib $(PORT)/*$(OEXT) $(PORTDIR); \
255         fi
256
257 port-specific-objects-pic16:
258         -if [ -d $(PORT) ]; then \
259           mkdir -p $(PORT)/bin; \
260           $(MAKE) -C $(PORT); \
261           cp -f $(PORT)/bin/*.* $(PORTDIR); \
262         fi
263
264 lib-files:
265         cp *.lib $(PORTDIR)
266
267 clean_intermediate:
268         rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
269
270 clean_intermediate-pic16:
271         $(MAKE) -C $(PORT) clean-intermediate
272
273 # Compiling and installing everything and runing test
274 # ---------------------------------------------------
275 install: all installdirs
276         cp -r -u $(BUILDDIR)/* $(sdcc_libdir)
277         cp -r -u ds390 ds400 gbz80 z80 hc08 *.c $(sdcc_libdir)/src
278         rm -r `find $(sdcc_libdir)/src -name '*.rel' -or -name '*.dump*' -or -name '*.sym' -or -name '*.o' -or -name '*.lst' -or -name '*.asm' -or -name 'CVS'`
279
280 # Deleting all the installed files
281 # --------------------------------
282 uninstall:
283         rm -rf $(sdcc_libdir)
284
285 # Performing self-test
286 # --------------------
287 check:
288
289
290 # Performing installation test
291 # ----------------------------
292 installcheck:
293
294
295 # Creating installation directories
296 # ---------------------------------
297 installdirs:
298         [ -d $(sdcc_libdir) ] || mkdir -p $(sdcc_libdir)
299         for model in $(MODELS); do \
300          [ -d $(sdcc_libdir)/$$model ] || \
301          mkdir -p $(sdcc_libdir)/$$model; \
302         done
303         [ -d $(sdcc_libdir)/ds390 ] || mkdir -p $(sdcc_libdir)/ds390
304         [ -d $(sdcc_libdir)/ds400 ] || mkdir -p $(sdcc_libdir)/ds400
305         [ -d $(sdcc_libdir)/hc08 ] || mkdir -p $(sdcc_libdir)/hc08
306         [ -d $(sdcc_libdir)/pic16 ] || mkdir -p $(sdcc_libdir)/pic16
307         mkdir -p $(sdcc_libdir)/src
308
309 # Creating dependencies
310 # ---------------------
311 dep: Makefile.dep
312
313 Makefile.dep: $(SOURCES) $(INCDIR)/*.h $(PORTINCDIR)/*.h
314         rm -f Makefile.dep
315         for i in $(SOURCES); do \
316           $(CPP) -std=c99 -M $(CPPFLAGS) $$i >$${i}.dep; \
317           cat $${i}.dep >>Makefile.dep; \
318           rm $${i}.dep; \
319         done
320
321 include Makefile.dep
322 include clean.mk
323
324 # My rules
325 # --------
326
327 .SUFFIXES: .rel .o
328
329 $(PORTDIR)/%$(OEXT): %.c
330         $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
331
332 # Remaking configuration
333 # ----------------------
334 checkconf:
335         @if [ -f $(PRJDIR)/devel ]; then\
336           $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
337           freshconf;\
338         fi
339
340 # End of main_in.mk/main.mk