]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
toolchain: ccache: Make two passes for ccache.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 Aug 2012 21:43:42 +0000 (17:43 -0400)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 Aug 2012 21:43:42 +0000 (17:43 -0400)
The first pass will compile ccache which is statically linked and
is used for the cross toolchain.
The second pass is dynamically linked and is used to the target
system.

lfs/ccache

index 3a8dc6e53573045557fa0b4b38ab19684c29e80a..f2e45a1e9f116762e90940d3f5a95dcc9bd0753b 100644 (file)
@@ -32,6 +32,13 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)-pass$(PASS)
 
+ifeq "$(PASS)" "1"
+       CFLAGS += -static
+endif
+
+# Set max cache size to 5GB
+CFLAGS += -DDEFAULT_MAXSIZE=5242880
+
 ###############################################################################
 # Top-level Rules
 ###############################################################################
@@ -70,15 +77,25 @@ $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
-       cd $(DIR_APP) && CFLAGS="-O2 -static -DDEFAULT_MAXSIZE=5242880" ./configure --prefix=$(ROOT)/usr/local
+       cd $(DIR_APP) && ./configure --prefix=/tools
        cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE)
        cd $(DIR_APP) && make install
-       ln -sf ccache $(ROOT)/usr/local/bin/gcc
-       ln -sf ccache $(ROOT)/usr/local/bin/g++
-       ln -sf ccache $(ROOT)/usr/local/bin/cc
-       ln -sf ccache $(ROOT)/usr/local/bin/$(BUILDTARGET)-gcc
-       ln -sf ccache $(ROOT)/usr/local/bin/$(BUILDTARGET)-g++
-       ln -sf ccache $(ROOT)/usr/local/bin/$(BUILDTARGET)-cc
-       $(ROOT)/usr/local/bin/ccache -z
+
+ifeq "$(PASS)" "1"
+       mkdir -pv /tools/ccache/bin
+       ln -svf ../../bin/ccache /tools/ccache/bin/gcc
+       ln -svf ../../bin/ccache /tools/ccache/bin/g++
+       ln -svf ../../bin/ccache /tools/ccache/bin/cc
+       ln -svf ../../bin/ccache /tools/ccache/bin/$(CROSSTARGET)-gcc
+       ln -svf ../../bin/ccache /tools/ccache/bin/$(CROSSTARGET)-g++
+       ln -svf ../../bin/ccache /tools/ccache/bin/$(CROSSTARGET)-cc
+endif
+
+ifeq "$(PASS)" "2"
+       ln -svf ../../bin/ccache /tools/ccache/bin/$(BUILDTARGET)-gcc
+       ln -svf ../../bin/ccache /tools/ccache/bin/$(BUILDTARGET)-g++
+       ln -svf ../../bin/ccache /tools/ccache/bin/$(BUILDTARGET)-cc
+endif
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)