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