cowond2: make sure the i2c delay loop code is actually generated by the eabi compiler.
[kugel-rb.git] / tools / functions.make
blob748263359e76f7f99a15e6553bb11b91a182b771
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
10 # preprocess - run preprocessor on a file and return the result as a string
12 # This uses the native 'gcc' compiler and not $(CC) since we use the -imacros
13 # option and older gcc compiler doesn't have that. We use one such older
14 # compiler for the win32 cross-compiles on Linux.
16 # The weird grep -v thing in here is due to Apple's stupidities and is needed
17 # to make this do right when used on Mac OS X.
19 # The sed line is to prepend the directory to all source files
21 preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c -include config.h $(1) | \
22 grep -v '^\#' | \
23 sed -e 's:^..*:$(dir $(1))&:')
25 preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \
26 grep -v '^\#' | grep -v "^$$" > $(2))
28 asmdefs2file = $(shell $(CC) $(PPCFLAGS) $(3) -S -x c -o - -include config.h $(1) | \
29 perl -ne 'if(/^_?AD_(\w+):$$/){$$var=$$1}else{/^\W\.(?:word|long)\W(.*)$$/ && $$var && print "\#define $$var $$1\n";$$var=0}' > $2)
31 c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1))))
33 # calculate dependencies for a list of source files $(2) and output them
34 # to a file $(1)_, to be later renamed to $(1).
35 mkdepfile = $(shell \
36 perl $(TOOLSDIR)/multigcc.pl $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -- $(2) | \
37 sed -e "s: lang.h: lang/lang.h:" \
38 -e 's:_asmdefs.o:_asmdefs.h:' \
39 -e "s: max_language_size.h: lang/max_language_size.h:" | \
40 $(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) \
41 >> $(1)_)
43 # function to create .bmp dependencies
44 bmpdepfile = $(shell \
45 for each in $(2); do \
46 obj=`echo $$each | sed -e 's/\.bmp/.o/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
47 src=`echo $$each | sed -e 's/\.bmp/.c/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
48 echo $$obj: $$src; \
49 echo $$src: $$each; \
50 done \
51 >> $(1); )
53 ifndef V
54 SILENT:=@
55 else
56 VERBOSEOPT:=-v
57 endif
58 PRINTS=$(SILENT)$(call info,$(1))
60 # old 'make' versions don't have the built-in 'info' function
61 info=old$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
62 ifeq ($(call info),old)
63 export info=echo "$$(1)";
64 endif