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