Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / non-free / lib / Makefile.in
blob96378f60fd2e7213d271b19759612ad6f64f9b28
5 VERSION = @VERSION@
6 VERSIONHI = @VERSIONHI@
7 VERSIONLO = @VERSIONLO@
8 VERSIONP = @VERSIONP@
10 SHELL = /bin/sh
11 INSTALL = @INSTALL@
12 CP = @CP@
13 AR_S = @AR@ @AR_S_FLAG@
15 LIB_TYPE = @LIB_TYPE@
17 ifeq ($(shell uname -s),Linux)
18 CP_U = $(CP) -u
19 else
20 CP_U = $(CP)
21 endif
23 top_builddir = @top_builddir@
24 top_srcdir = @top_srcdir@
25 VPATH = @srcdir@
26 srcdir = @srcdir@
27 INCDIR = $(top_srcdir)/device/include
28 ifndef PORTINCDIR
29 PORTINCDIR = $(INCDIR)/mcs51
30 endif
32 CC = $(top_builddir)/bin/sdcc
33 CPP = $(top_builddir)/bin/sdcpp
35 prefix = @prefix@
36 exec_prefix = @exec_prefix@
37 bindir = @bindir@
38 libdir = @libdir@
39 datadir = @datadir@
40 datarootdir = @datarootdir@
41 includedir = @includedir@
42 mandir = @mandir@
43 man1dir = $(mandir)/man1
44 man2dir = $(mandir)/man2
45 infodir = @infodir@
47 non_free_lib_dir_suffix = @non_free_lib_dir_suffix@
49 sdcc_libdir = $(DESTDIR)$(datadir)/$(non_free_lib_dir_suffix)
51 CPPFLAGS = -I$(INCDIR) -I$(PORTINCDIR)
52 CFLAGS = $(MODELFLAGS) --nostdinc --std-c99
54 BUILDDIR = build
55 # Default
56 PORT = z80
57 ifndef PORTDIR
58 PORTDIR = $(BUILDDIR)/$(PORT)
59 endif
61 OPT_DISABLE_AVR = @OPT_DISABLE_AVR@
62 OPT_DISABLE_DS390 = @OPT_DISABLE_DS390@
63 OPT_DISABLE_DS400 = @OPT_DISABLE_DS400@
64 OPT_DISABLE_GBZ80 = @OPT_DISABLE_GBZ80@
65 OPT_DISABLE_HC08 = @OPT_DISABLE_HC08@
66 OPT_DISABLE_MCS51 = @OPT_DISABLE_MCS51@
67 OPT_DISABLE_PIC14 = @OPT_DISABLE_PIC14@
68 OPT_DISABLE_PIC16 = @OPT_DISABLE_PIC16@
69 OPT_DISABLE_XA51 = @OPT_DISABLE_XA51@
70 OPT_DISABLE_Z80 = @OPT_DISABLE_Z80@
72 OBJECTS_FLOAT = $(SOURCES_FLOAT:%.c=$(PORT)/%.rel)
73 OBJECTS_INT = $(SOURCES_INT:%.c=$(PORT)/%.rel)
74 OBJECTS_LONG = $(SOURCES_LONG:%.c=$(PORT)/%.rel)
75 OBJECTS_SDCC = $(SOURCES_SDCC:%.c=$(PORT)/%.rel)
77 OBJECTS = $(OBJECTS_FLOAT) $(OBJECTS_INT) $(OBJECTS_LONG) $(OBJECTS_SDCC)
79 XA51_FLOAT = $(COMMON_FLOAT)
81 XA51_INT = $(COMMON_INT) \
82 _divsint.c \
83 _divuint.c \
84 _modsint.c \
85 _moduint.c \
86 _mulint.c
88 XA51_LONG = $(COMMON_LONG) \
89 _divulong.c \
90 _mullong.c
92 XA51_SDCC = $(COMMON_SDCC) \
93 _memmove.c \
94 _strlen.c \
95 _heap.c
97 XA51SOURCES = $(XA51_FLOAT) $(XA51_INT) $(XA51_LONG) $(XA51_SDCC)
98 XA51OBJECTS = $(XA51SOURCES:%.c=$(PORT)/%.rel)
100 LIB_FILES = $(PORTDIR)/libfloat.lib $(PORTDIR)/libint.lib $(PORTDIR)/liblong.lib $(PORTDIR)/libsdcc.lib
102 OEXT = .rel
104 include $(srcdir)/incl.mk
106 ifeq ($(OPT_DISABLE_PIC14), 0)
107 TARGETS += model-pic14
108 endif
110 ifeq ($(OPT_DISABLE_PIC16), 0)
111 TARGETS += model-pic16
112 endif
114 ENABLED_PORTS = $(TARGETS:model-%=%)
116 # Compiling entire program or any subproject
117 # ------------------------------------------
118 all:
119 $(MAKE) checkconf
120 ifneq ($(TARGETS), )
121 $(MAKE) $(TARGETS)
122 endif
124 objects:
125 $(MAKE) build-dir
126 $(MAKE) $(OBJECTS)
127 $(MAKE) port-specific-objects
128 $(MAKE) $(LIB_FILES)
129 $(MAKE) clean_intermediate
131 models:
132 if grep '^mcs51\>' $(top_builddir)/ports.build > /dev/null; then \
133 for model in $(MODELS); do \
134 $(MAKE) MODELFLAGS="--model-$$model" PORT=$$model PORTINCDIR=$(INCDIR)/mcs51 objects; \
135 done \
138 small-mcs51-stack-auto:
139 if grep '^mcs51\>' $(top_builddir)/ports.build > /dev/null; then \
140 mkdir -p small-stack-auto; cp small/Makefile small-stack-auto; \
141 $(MAKE) MODELFLAGS="--model-small --stack-auto" PORT=small-stack-auto PORTDIR=$(BUILDDIR)/small-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
144 model-mcs51-stack-auto:
145 if grep '^mcs51\>' $(top_builddir)/ports.build > /dev/null; then \
146 for model in $(MODELS); do \
147 mkdir -p $${model}-stack-auto; cp $${model}/Makefile $${model}-stack-auto; \
148 $(MAKE) MODELFLAGS="--model-$$model --stack-auto" PORT=$${model}-stack-auto PORTDIR=$(BUILDDIR)/$${model}-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
149 done \
152 model-mcs51-xstack-auto:
153 if grep '^mcs51\>' $(top_builddir)/ports.build > /dev/null; then \
154 for model in $(MODELS); do \
155 mkdir -p $${model}-xstack-auto; cp $${model}/Makefile $${model}-xstack-auto; \
156 $(MAKE) MODELFLAGS="--model-$$model --stack-auto --xstack" PORT=$${model}-xstack-auto PORTDIR=$(BUILDDIR)/$${model}-xstack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
157 done \
160 model-ds390:
161 if grep '^ds390\>' $(top_builddir)/ports.build > /dev/null; then \
162 $(MAKE) MODELFLAGS="-mds390" PORT=ds390 PORTINCDIR=$(INCDIR)/mcs51 objects; \
165 model-ds400:
166 if grep '^ds400\>' $(top_builddir)/ports.build > /dev/null; then \
167 $(MAKE) MODELFLAGS="-mds400" PORT=ds400 PORTINCDIR=$(INCDIR)/mcs51 objects; \
170 model-xa51:
171 if grep '^xa51\>' $(top_builddir)/ports.build > /dev/null; then \
172 $(MAKE) MODELFLAGS="-mxa51" PORT=xa51 objects-xa51; \
175 objects-xa51:
176 $(MAKE) build-dir
177 $(MAKE) $(XA51OBJECTS)
178 $(MAKE) port-specific-objects
180 $(PORTDIR)/lib$(PORT).lib: $(XA51OBJECTS)
181 ifeq ($(LIB_TYPE), SDCCLIB)
182 ../../bin/sdcclib -a $(PORTDIR)/lib$(PORT).lib $(XA51OBJECTS)
183 else
184 ifeq ($(LIB_TYPE), AR)
185 $(AR_S) -q $(PORTDIR)/lib$(PORT).lib $(XA51OBJECTS)
186 else
187 ifeq ($(LIB_TYPE), RANLIB)
188 $(AR_S) -q $(PORTDIR)/lib$(PORT).lib $(XA51OBJECTS)
189 $(top_builddir)/bin/sdranlib $(PORTDIR)/lib$(PORT).lib
190 else
191 rm -f $(PORTDIR)/lib$(PORT).lib
192 for i in $(notdir $(basename $(XA51OBJECTS))); do echo $$i >> $(PORTDIR)/lib$(PORT).lib; done
193 cp $(XA51OBJECTS) $(PORTDIR)
194 endif
195 endif
196 endif
198 model-z80:
199 if grep '^z80\>' $(top_builddir)/ports.build > /dev/null; then \
200 $(MAKE) MODELFLAGS="-mz80" PORT=z80 objects-z80 OEXT=.o; \
203 model-gbz80:
204 if grep '^z80\>' $(top_builddir)/ports.build > /dev/null; then \
205 $(MAKE) MODELFLAGS="-mgbz80" PORT=gbz80 objects-z80 OEXT=.o; \
208 objects-z80:
209 $(MAKE) build-dir
210 $(MAKE) port-specific-objects
211 $(MAKE) clean_intermediate
213 model-hc08:
214 if grep '^hc08\>' $(top_builddir)/ports.build > /dev/null; then \
215 $(MAKE) MODELFLAGS="-mhc08" PORT=hc08 objects-hc08; \
218 objects-hc08:
219 $(MAKE) build-dir
220 $(MAKE) port-specific-objects
221 $(MAKE) clean_intermediate
223 model-pic16:
224 if grep '^pic16\>' $(top_builddir)/ports.build > /dev/null; then \
225 $(MAKE) PORT=pic16 objects-pic16; \
228 objects-pic16:
229 $(MAKE) build-dir
230 $(MAKE) port-specific-objects-pic16
231 $(MAKE) clean_intermediate-pic16
233 model-pic14:
234 if grep '^pic14\>' $(top_builddir)/ports.build > /dev/null; then \
235 $(MAKE) PORT=pic14 objects-pic14; \
238 objects-pic14:
239 $(MAKE) build-dir
240 $(MAKE) port-specific-objects-pic14
241 $(MAKE) clean_intermediate-pic14
243 build-dir:
244 $(MAKE) $(PORTDIR)
245 $(MAKE) $(PORT)
247 $(PORTDIR):
248 mkdir -p $(PORTDIR)
250 $(PORT):
251 mkdir -p $(PORT)
253 port-specific-objects:
254 -if [ -f $(PORT)/Makefile ]; then \
255 $(MAKE) -C $(PORT) PORT=$(PORT); \
258 port-specific-objects-pic16:
259 -if [ -f $(PORT)/Makefile ]; then \
260 $(MAKE) -C $(PORT); \
261 for i in $(PORT)/*/lib*.a; do cp -f $$i $(PORTDIR)/`basename $$i .a`.lib; done; \
264 port-specific-objects-pic14:
265 -if [ -f $(PORT)/Makefile ]; then \
266 mkdir -p $(PORT)/bin; \
267 $(MAKE) -C $(PORT); \
268 cp -f $(PORT)/bin/*.* $(PORTDIR); \
271 ifeq ($(LIB_TYPE), SDCCLIB)
273 $(PORTDIR)/libfloat.lib: $(OBJECTS_FLOAT)
274 ../../bin/sdcclib -a $(PORTDIR)/libfloat.lib $(OBJECTS_FLOAT)
276 $(PORTDIR)/libint.lib: $(OBJECTS_INT)
277 ../../bin/sdcclib -a $(PORTDIR)/libint.lib $(OBJECTS_INT)
279 $(PORTDIR)/liblong.lib: $(OBJECTS_LONG)
280 ../../bin/sdcclib -a $(PORTDIR)/liblong.lib $(OBJECTS_LONG)
282 $(PORTDIR)/libsdcc.lib: $(OBJECTS_SDCC)
283 ../../bin/sdcclib -a $(PORTDIR)/libsdcc.lib $(OBJECTS_SDCC)
285 else
286 ifeq ($(LIB_TYPE), AR)
288 $(PORTDIR)/libfloat.lib: $(OBJECTS_FLOAT)
289 $(AR_S) -cq $(PORTDIR)/libfloat.lib $(OBJECTS_FLOAT)
291 $(PORTDIR)/libint.lib: $(OBJECTS_INT)
292 $(AR_S) -cq $(PORTDIR)/libint.lib $(OBJECTS_INT)
294 $(PORTDIR)/liblong.lib: $(OBJECTS_LONG)
295 $(AR_S) -cq $(PORTDIR)/liblong.lib $(OBJECTS_LONG)
297 $(PORTDIR)/libsdcc.lib: $(OBJECTS_SDCC)
298 $(AR_S) -cq $(PORTDIR)/libsdcc.lib $(OBJECTS_SDCC)
300 else
301 ifeq ($(LIB_TYPE), RANLIB)
303 $(PORTDIR)/libfloat.lib: $(OBJECTS_FLOAT)
304 $(AR_S) -cq $(PORTDIR)/libfloat.lib $(OBJECTS_FLOAT); $(top_builddir)/bin/sdranlib $(PORTDIR)/libfloat.lib
306 $(PORTDIR)/libint.lib: $(OBJECTS_INT)
307 $(AR_S) -cq $(PORTDIR)/libint.lib $(OBJECTS_INT); $(top_builddir)/bin/sdranlib $(PORTDIR)/libint.lib
309 $(PORTDIR)/liblong.lib: $(OBJECTS_LONG)
310 $(AR_S) -cq $(PORTDIR)/liblong.lib $(OBJECTS_LONG); $(top_builddir)/bin/sdranlib $(PORTDIR)/liblong.lib
312 $(PORTDIR)/libsdcc.lib: $(OBJECTS_SDCC)
313 $(AR_S) -cq $(PORTDIR)/libsdcc.lib $(OBJECTS_SDCC); $(top_builddir)/bin/sdranlib $(PORTDIR)/libsdcc.lib
315 else
317 $(PORTDIR)/libfloat.lib: $(OBJECTS_FLOAT)
318 rm -f $(PORTDIR)/libfloat.lib
319 for i in $(notdir $(basename $(OBJECTS_FLOAT))); do echo $$i >> $(PORTDIR)/libfloat.lib; done
320 cp $(OBJECTS_FLOAT) $(PORTDIR)
322 $(PORTDIR)/libint.lib: $(OBJECTS_INT)
323 rm -f $(PORTDIR)/libint.lib
324 for i in $(notdir $(basename $(OBJECTS_INT))); do echo $$i >> $(PORTDIR)/libint.lib; done
325 cp $(OBJECTS_INT) $(PORTDIR)
327 $(PORTDIR)/liblong.lib: $(OBJECTS_LONG)
328 rm -f $(PORTDIR)/liblong.lib
329 for i in $(notdir $(basename $(OBJECTS_LONG))); do echo $$i >> $(PORTDIR)/liblong.lib; done
330 cp $(OBJECTS_LONG) $(PORTDIR)
332 $(PORTDIR)/libsdcc.lib: $(OBJECTS_SDCC)
333 rm -f $(PORTDIR)/libsdcc.lib
334 for i in $(notdir $(basename $(OBJECTS_SDCC))); do echo $$i >> $(PORTDIR)/libsdcc.lib; done
335 cp $(OBJECTS_SDCC) $(PORTDIR)
337 endif
338 endif
339 endif
341 clean_intermediate:
342 rm -f $(PORTDIR)/*.lst $(PORTDIR)/*.sym
344 clean_intermediate-pic16:
345 $(MAKE) -C $(PORT) clean-intermediate
347 clean_intermediate-pic14:
348 $(MAKE) -C $(PORT) clean-intermediate
350 # Compiling and installing everything and runing test
351 # ---------------------------------------------------
353 install: all installdirs
354 ifneq ($(TARGETS), )
355 [ ! -d "$(BUILDDIR)" ] || $(CP_U) -r $(BUILDDIR)/* $(sdcc_libdir)
356 $(CP_U) -r $(foreach p, $(ENABLED_PORTS), $(srcdir)/$(p)) $(sdcc_libdir)/src
358 for src in $(ENABLED_PORTS); do \
359 find $(sdcc_libdir)/src/$$src -depth \
360 \( -name '*.rel' -o -name '*.dump*' -o -name '*.sym' -o -name '*.o' -o -name '*.lib' -o \
361 -name '*.lst' -o -name '*.asm' -o -name '.svn' -o -name 'autom4te.cache' -o \
362 -name 'build' -o -name 'bin' -o -name 'Makefile*' -o -name 'config*' -o \
363 -name 'depcomp' -o -name 'missing' -o -name 'install-sh' -o \
364 -name 'bootstrap.sh' \) \
365 -exec rm -rf {} + ; \
366 done
367 endif
369 # Deleting all the installed files
370 # --------------------------------
371 uninstall:
372 rm -rf $(sdcc_libdir)
374 # Performing self-test
375 # --------------------
376 check:
379 # Performing installation test
380 # ----------------------------
381 installcheck:
384 # Creating installation directories
385 # ---------------------------------
386 installdirs:
387 ifneq ($(TARGETS), )
388 for libdir in $(ENABLED_PORTS); do \
389 mkdir -p $(sdcc_libdir)/$$libdir; \
390 done
391 mkdir -p $(sdcc_libdir)/src
392 endif
394 # Creating dependencies
395 # ---------------------
396 dep: Makefile.dep
398 Makefile.dep: $(INCDIR)/*.h $(PORTINCDIR)/*.h
399 rm -f Makefile.dep
400 for i in $(filter %.c,$^); do \
401 $(CPP) -std=c99 -M $(CPPFLAGS) $$i >$${i}.dep; \
402 cat $${i}.dep >>Makefile.dep; \
403 rm $${i}.dep; \
404 done
406 ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs checkconf \
407 clean distclean mostlyclean realclean)" ""
408 -include Makefile.dep
409 endif
410 include $(srcdir)/clean.mk
412 # My rules
413 # --------
415 .SUFFIXES: .rel .o
417 $(PORT)/%$(OEXT): %.c
418 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
420 # Remaking configuration
421 # ----------------------
422 checkconf:
423 @if [ -f $(top_builddir)/devel ]; then\
424 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" \
425 freshconf;\
428 # End of main_in.mk/main.mk