Skip to content

Commit

Permalink
tools: clean up Makefiles / make ccache work
Browse files Browse the repository at this point in the history
SVN-Revision: 29754
  • Loading branch information
John Crispin committed Jan 15, 2012
1 parent f9e41ad commit ccb6b0a
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 83 deletions.
1 change: 1 addition & 0 deletions include/host-build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ define Host/Prepare
endef

HOST_CONFIGURE_VARS = \
CC="$(HOSTCC)" \
CFLAGS="$(HOST_CFLAGS)" \
CPPFLAGS="$(HOST_CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \
Expand Down
2 changes: 2 additions & 0 deletions rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config
export PKG_CONFIG

HOSTCC:=gcc
HOSTCC_NOCACHE:=$(HOSTCC)
HOST_CFLAGS:=-O2 -I$(STAGING_DIR_HOST)/include
HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib

Expand All @@ -188,6 +189,7 @@ INSTALL_CONF:=install -m0600
ifneq ($(CONFIG_CCACHE),)
TARGET_CC:= ccache $(TARGET_CC)
TARGET_CXX:= ccache $(TARGET_CXX)
HOSTCC:= ccache $(HOSTCC)
endif

TARGET_CONFIGURE_OPTS = \
Expand Down
8 changes: 6 additions & 2 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2
tools-$(CONFIG_powerpc) += upx
tools-$(CONFIG_TARGET_x86) += qemu
ifneq ($(CONFIG_TARGET_ar71xx),)
tools-y += lzma-old squashfs
tools-y += lzma-old squashfs
endif
tools-y += lzma squashfs4
tools-$(CONFIG_CCACHE) += ccache

ifdef CONFIG_GCC_USE_GRAPHITE
ifeq ($(CONFIG_GCC_USE_SYSTEM_PPL_CLOOG),)
Expand Down Expand Up @@ -59,6 +58,11 @@ $(curdir)/missing-macros/compile := $(curdir)/automake/install
$(curdir)/e2fsprogs/compile := $(curdir)/automake/install
$(curdir)/libelf/compile := $(curdir)/automake/install

ifneq ($(CONFIG_CCACHE),)
$(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/install))
tools-y += ccache
endif

$(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-)
$(curdir)/builddirs-default := $(tools-y)

Expand Down
10 changes: 1 addition & 9 deletions tools/automake/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@ PKG_MD5SUM:=c2972c4d9b3e29c03d5f2af86249876f

include $(INCLUDE_DIR)/host-build.mk

define Host/Configure
$(call Host/Configure/Default,\
--datarootdir=$(STAGING_DIR_HOST)/share \
)
endef

define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)
endef
HOST_CONFIGURE_ARGS += --datarootdir=$(STAGING_DIR_HOST)/share

define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) install
Expand Down
8 changes: 0 additions & 8 deletions tools/bison/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ PKG_CAT:=bzcat

include $(INCLUDE_DIR)/host-build.mk

define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)
endef

define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) install
endef

define Host/Clean
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
$(call Host/Clean/Default)
Expand Down
8 changes: 3 additions & 5 deletions tools/ccache/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ include $(INCLUDE_DIR)/host-build.mk

ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found)
define Host/Compile
$(MAKE) CC="$(HOSTCC)" -C $(HOST_BUILD_DIR)
endef

define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) install
$(MAKE) CC="$(HOSTCC_NOCACHE)" -C $(HOST_BUILD_DIR)
endef

define Host/Clean
Expand All @@ -41,6 +37,8 @@ else
endef
define Host/Clean
endef
define Download
endef
endif

$(eval $(call HostBuild))
2 changes: 1 addition & 1 deletion tools/firmware-utils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/kernel.mk

define cc
$(CC) $(HOST_CFLAGS) -include endian.h -o $(HOST_BUILD_DIR)/bin/$(firstword $(1)) $(foreach src,$(1),src/$(src).c) $(2)
$(HOSTCC) $(HOST_CFLAGS) -include endian.h -o $(HOST_BUILD_DIR)/bin/$(firstword $(1)) $(foreach src,$(1),src/$(src).c) $(2)
endef

define Host/Compile
Expand Down
8 changes: 0 additions & 8 deletions tools/flex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ PKG_CAT:=bzcat

include $(INCLUDE_DIR)/host-build.mk

define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)
endef

define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) install
endef

define Host/Clean
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
$(call Host/Clean/Default)
Expand Down
36 changes: 16 additions & 20 deletions tools/genext2fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,22 @@ PKG_MD5SUM:=b7b6361bcce2cedff1ae437fadafe53b

include $(INCLUDE_DIR)/host-build.mk

define Host/Configure
( cd $(HOST_BUILD_DIR); \
./configure \
--target=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--build=$(GNU_HOST_NAME) \
--program-prefix="" \
--program-suffix="" \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--libexecdir=/usr/lib \
--sysconfdir=/etc \
--datadir=/usr/share \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info \
)
endef
HOST_CONFIGURE_ARGS = \
--target=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--build=$(GNU_HOST_NAME) \
--program-prefix="" \
--program-suffix="" \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--libexecdir=/usr/lib \
--sysconfdir=/etc \
--datadir=/usr/share \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info \

define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR) \
Expand Down
9 changes: 0 additions & 9 deletions tools/gmp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,4 @@ HOST_CONFIGURE_ARGS += \
--enable-cxx \
--enable-mpbsd

define Host/Configure
(cd $(HOST_BUILD_DIR)/$(3); \
$(HOST_CONFIGURE_CMD) \
$(HOST_CONFIGURE_VARS) \
$(HOST_CONFIGURE_ARGS); \
)
endef


$(eval $(call HostBuild))
4 changes: 0 additions & 4 deletions tools/libtool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ include $(INCLUDE_DIR)/host-build.mk
HOST_CONFIGURE_VARS += \
lt_cv_sys_dlsearch_path=""

define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)
endef

define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) install
$(SED) 's,\(hardcode_into_libs\)=yes,\1=no,g' $(STAGING_DIR_HOST)/bin/libtool
Expand Down
8 changes: 0 additions & 8 deletions tools/m4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ PKG_CAT:=zcat

include $(INCLUDE_DIR)/host-build.mk

define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)
endef

define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) install
endef

define Host/Clean
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
$(call Host/Clean/Default)
Expand Down
4 changes: 0 additions & 4 deletions tools/padjffs2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ endef
define Host/Configure
endef

define Host/Compile
$(MAKE) CC="$(HOSTCC)" -C $(HOST_BUILD_DIR)
endef

define Host/Install
$(CP) $(HOST_BUILD_DIR)/padjffs2 $(STAGING_DIR_HOST)/bin/
endef
Expand Down
4 changes: 0 additions & 4 deletions tools/pkg-config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ PKG_MD5SUM:=a3270bab3f4b69b7dc6dbdacbcae9745

include $(INCLUDE_DIR)/host-build.mk

define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)
endef

define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) \
install
Expand Down
2 changes: 1 addition & 1 deletion tools/sstrip/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PKG_NAME:=sstrip
include $(INCLUDE_DIR)/host-build.mk

define Host/Compile
$(CC) $(HOST_CFLAGS) -I./include -include endian.h -o $(HOST_BUILD_DIR)/sstrip src/sstrip.c
$(HOSTCC) $(HOST_CFLAGS) -I./include -include endian.h -o $(HOST_BUILD_DIR)/sstrip src/sstrip.c
endef

define Host/Install
Expand Down

0 comments on commit ccb6b0a

Please sign in to comment.