tuner-as3525v2.c: only build what's needed
[maemo-rb.git] / tools / functions.make
blob26fc471c3c229966ec707e39f0da675b60d1baff
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 # The weird grep -v thing in here is due to Apple's stupidities and is needed
13 # to make this do right when used on Mac OS X.
15 # The sed line is to prepend the directory to all source files
17 preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c -include config.h $(1) | \
18 grep -v '^\#' | \
19 sed -e 's:^..*:$(dir $(1))&:')
21 preprocess2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \
22 grep -v '^\#' | grep -v "^$$" > $(2)
24 asmdefs2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -S -x c -o - -include config.h $(1) | \
25 perl -ne 'if(/^_?AD_(\w+):$$/){$$var=$$1}else{/^\W\.(?:word|long)\W(.*)$$/ && $$var && print "\#define $$var $$1\n";$$var=0}' > $(2)
27 c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1))))
29 # calculate dependencies for a list of source files $(2) and output them to $(1)
30 mkdepfile = $(SILENT)perl $(TOOLSDIR)/multigcc.pl $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -- $(2) | \
31 sed -e "s: lang.h: lang/lang.h:" \
32 -e 's:_asmdefs.o:_asmdefs.h:' \
33 -e "s: max_language_size.h: lang/max_language_size.h:" | \
34 $(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) \
35 >> $(1)
37 # function to create .bmp dependencies
38 bmpdepfile = $(SILENT) \
39 for each in $(2); do \
40 obj=`echo $$each | sed -e 's/\.bmp/.o/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
41 src=`echo $$each | sed -e 's/\.bmp/.c/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
42 echo $$obj: $$src; \
43 echo $$src: $$each; \
44 done \
45 >> $(1)
47 ifndef V
48 SILENT:=@
49 else
50 VERBOSEOPT:=-v
51 endif
52 PRINTS=$(SILENT)$(call info,$(1))
54 # old 'make' versions don't have the built-in 'info' function
55 info=old$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
56 ifeq ($(call info),old)
57 export info=echo "$$(1)";
58 endif