2002-04-12 12:05:57 +00:00
|
|
|
# Rules.make for busybox
|
|
|
|
#
|
2005-11-29 02:53:52 +00:00
|
|
|
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
2002-04-12 12:05:57 +00:00
|
|
|
#
|
2005-11-29 02:53:52 +00:00
|
|
|
# Licensed under GPLv2, see the file LICENSE in this tarball for details.
|
2002-04-12 12:05:57 +00:00
|
|
|
#
|
|
|
|
|
2005-11-29 02:52:25 +00:00
|
|
|
# Pull in the user's busybox configuration
|
|
|
|
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
|
|
|
|
-include $(top_builddir)/.config
|
|
|
|
endif
|
|
|
|
|
2006-03-01 22:54:48 +00:00
|
|
|
ifeq ($(HAVE_DOT_CONFIG),y)
|
|
|
|
rules-mak-rules:=0
|
|
|
|
endif
|
|
|
|
|
2002-12-05 08:41:41 +00:00
|
|
|
#--------------------------------------------------------
|
2002-04-12 12:05:57 +00:00
|
|
|
PROG := busybox
|
2005-10-13 10:40:18 +00:00
|
|
|
MAJOR_VERSION :=1
|
|
|
|
MINOR_VERSION :=1
|
2006-01-19 09:22:39 +00:00
|
|
|
SUBLEVEL_VERSION:=1
|
|
|
|
EXTRAVERSION :=-pre0
|
2005-10-13 10:40:18 +00:00
|
|
|
VERSION :=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)$(EXTRAVERSION)
|
2002-04-12 12:05:57 +00:00
|
|
|
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
|
|
|
|
|
|
|
|
|
2002-12-05 08:41:41 +00:00
|
|
|
#--------------------------------------------------------
|
2002-04-12 12:05:57 +00:00
|
|
|
# With a modern GNU make(1) (highly recommended, that's what all the
|
|
|
|
# developers use), all of the following configuration values can be
|
|
|
|
# overridden at the command line. For example:
|
2005-10-05 07:40:46 +00:00
|
|
|
# make CROSS=powerpc-linux- top_srcdir="$HOME/busybox" PREFIX=/mnt/app
|
2002-12-05 08:41:41 +00:00
|
|
|
#--------------------------------------------------------
|
2002-04-12 12:05:57 +00:00
|
|
|
|
2002-12-05 08:41:41 +00:00
|
|
|
# If you are running a cross compiler, you will want to set 'CROSS'
|
|
|
|
# to something more interesting... Target architecture is determined
|
|
|
|
# by asking the CC compiler what arch it compiles things for, so unless
|
2006-03-01 22:54:48 +00:00
|
|
|
# your compiler is broken, you should not need to specify __TARGET_ARCH
|
2003-11-05 11:34:26 +00:00
|
|
|
CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
|
2006-03-01 22:54:48 +00:00
|
|
|
#")
|
2003-11-05 11:34:26 +00:00
|
|
|
CC = $(CROSS)gcc
|
|
|
|
AR = $(CROSS)ar
|
|
|
|
AS = $(CROSS)as
|
|
|
|
LD = $(CROSS)ld
|
|
|
|
NM = $(CROSS)nm
|
|
|
|
STRIP = $(CROSS)strip
|
|
|
|
CPP = $(CC) -E
|
2006-03-01 22:54:48 +00:00
|
|
|
SED ?= sed
|
|
|
|
AWK ?= awk
|
|
|
|
|
|
|
|
|
|
|
|
ifdef PACKAGE_BE_VERBOSE
|
|
|
|
PACKAGE_BE_VERBOSE := $(shell echo $(PACKAGE_BE_VERBOSE) | $(SED) "s/[[:alpha:]]*//g")
|
|
|
|
endif
|
2005-10-13 10:40:18 +00:00
|
|
|
|
2006-03-01 22:54:48 +00:00
|
|
|
# for make V=3 and above make $(shell) invocations verbose
|
|
|
|
ifeq ($(if $(strip $(PACKAGE_BE_VERBOSE)),$(shell test $(PACKAGE_BE_VERBOSE) -gt 2 ; echo $$?),1),0)
|
|
|
|
SHELL+=-x
|
|
|
|
MKDEP_ARGS:=-w
|
|
|
|
endif
|
2002-04-12 12:05:57 +00:00
|
|
|
|
2002-12-05 08:41:41 +00:00
|
|
|
# What OS are you compiling busybox for? This allows you to include
|
|
|
|
# OS specific things, syscall overrides, etc.
|
2003-11-05 11:34:26 +00:00
|
|
|
TARGET_OS=linux
|
2002-12-05 08:41:41 +00:00
|
|
|
|
|
|
|
# Select the compiler needed to build binaries for your development system
|
2003-11-05 11:34:26 +00:00
|
|
|
HOSTCC = gcc
|
2002-12-16 21:55:39 +00:00
|
|
|
HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
|
2002-04-12 12:05:57 +00:00
|
|
|
|
2004-03-15 08:29:22 +00:00
|
|
|
# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
|
2003-01-14 09:12:39 +00:00
|
|
|
LC_ALL:= C
|
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
# initialize flags here
|
|
|
|
CFLAGS:=
|
|
|
|
CFLAGS_COMBINE:=
|
|
|
|
CFLAGS_PIC:=
|
|
|
|
LD_FLAGS:=
|
|
|
|
LIB_LDFLAGS:=
|
|
|
|
PROG_LDFLAGS:=
|
|
|
|
PROG_CFLAGS:=
|
|
|
|
OPTIMIZATIONS:=
|
|
|
|
|
2002-12-05 08:41:41 +00:00
|
|
|
# If you want to add some simple compiler switches (like -march=i686),
|
|
|
|
# especially from the command line, use this instead of CFLAGS directly.
|
2006-03-01 22:54:48 +00:00
|
|
|
# For optimization overrides, it's better still to set OPTIMIZATIONS.
|
2002-12-05 08:41:41 +00:00
|
|
|
CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
|
2006-03-01 22:54:48 +00:00
|
|
|
#")
|
2004-03-15 08:29:22 +00:00
|
|
|
|
2002-04-12 12:05:57 +00:00
|
|
|
# To compile vs some other alternative libc, you may need to use/adjust
|
|
|
|
# the following lines to meet your needs...
|
|
|
|
#
|
|
|
|
# If you are using Red Hat 6.x with the compatible RPMs (for developing under
|
|
|
|
# Red Hat 5.x and glibc 2.0) uncomment the following. Be sure to read about
|
|
|
|
# using the compatible RPMs (compat-*) at http://www.redhat.com !
|
|
|
|
#LIBCDIR:=/usr/i386-glibc20-linux
|
|
|
|
#
|
2003-07-22 08:56:01 +00:00
|
|
|
# For other libraries, you are on your own. But these may (or may not) help...
|
2002-04-12 12:05:57 +00:00
|
|
|
#LDFLAGS+=-nostdlib
|
|
|
|
#LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc
|
2005-12-01 17:01:43 +00:00
|
|
|
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) -funsigned-char
|
2002-04-12 12:05:57 +00:00
|
|
|
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
|
|
|
|
|
2002-12-16 21:55:39 +00:00
|
|
|
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
|
2006-03-01 22:54:48 +00:00
|
|
|
CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include
|
2006-01-15 14:04:57 +00:00
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
ARFLAGS=cru
|
2002-04-12 12:05:57 +00:00
|
|
|
|
2005-12-13 11:52:46 +00:00
|
|
|
|
2006-03-01 22:54:48 +00:00
|
|
|
|
|
|
|
# Get the CC MAJOR/MINOR version
|
2005-12-13 11:52:46 +00:00
|
|
|
# gcc centric. Perhaps fiddle with findstring gcc,$(CC) for the rest
|
|
|
|
CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1))
|
|
|
|
CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1))
|
|
|
|
|
2006-03-01 22:54:48 +00:00
|
|
|
# Note: spaces are significant here!
|
|
|
|
# Check if CC version is equal to given MAJOR,MINOR. Returns empty if false.
|
|
|
|
define cc_eq
|
|
|
|
$(shell [ $(CC_MAJOR) -eq $(1) -a $(CC_MINOR) -eq $(2) ] && echo y)
|
|
|
|
endef
|
|
|
|
# Check if CC version is greater or equal than given MAJOR,MINOR
|
|
|
|
define cc_ge
|
|
|
|
$(shell [ $(CC_MAJOR) -ge $(1) -a $(CC_MINOR) -ge $(2) ] && echo y)
|
|
|
|
endef
|
|
|
|
# Check if CC version is less or equal than given MAJOR,MINOR
|
|
|
|
define cc_le
|
|
|
|
$(shell [ $(CC_MAJOR) -le $(1) -a $(CC_MINOR) -le $(2) ] && echo y)
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Workaround bugs in make-3.80 for eval in conditionals
|
|
|
|
define is_eq
|
|
|
|
$(shell [ $(1) = $(2) ] 2> /dev/null && echo y)
|
|
|
|
endef
|
|
|
|
define is_neq
|
|
|
|
$(shell [ $(1) != $(2) ] 2> /dev/null && echo y)
|
|
|
|
endef
|
|
|
|
|
2002-12-05 08:41:41 +00:00
|
|
|
#--------------------------------------------------------
|
2005-09-26 16:01:43 +00:00
|
|
|
export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
|
2006-03-01 22:54:48 +00:00
|
|
|
|
|
|
|
# TARGET_ARCH and TARGET_MACH will be passed verbatim to CC with recent
|
|
|
|
# versions of make, so we use __TARGET_ARCH here.
|
|
|
|
# Current builtin rules looks like that:
|
|
|
|
# COMPILE.s = $(AS) $(ASFLAGS) $(TARGET_MACH)
|
|
|
|
# COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
|
|
|
|
|
|
|
|
ifeq ($(strip $(__TARGET_ARCH)),)
|
|
|
|
__TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
|
2002-06-23 04:50:49 +00:00
|
|
|
-e 's/i.86/i386/' \
|
|
|
|
-e 's/sparc.*/sparc/' \
|
|
|
|
-e 's/arm.*/arm/g' \
|
|
|
|
-e 's/m68k.*/m68k/' \
|
|
|
|
-e 's/ppc/powerpc/g' \
|
|
|
|
-e 's/v850.*/v850/g' \
|
|
|
|
-e 's/sh[234]/sh/' \
|
2002-12-05 08:41:41 +00:00
|
|
|
-e 's/mips-.*/mips/' \
|
|
|
|
-e 's/mipsel-.*/mipsel/' \
|
|
|
|
-e 's/cris.*/cris/' \
|
|
|
|
)
|
2003-11-05 11:34:26 +00:00
|
|
|
endif
|
2002-12-05 08:41:41 +00:00
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
CFLAGS+=$(call check_gcc,CFLAGS,-funsigned-char,)
|
|
|
|
CFLAGS+=$(call check_gcc,CFLAGS,-mmax-stack-frame=256,)
|
2006-01-15 14:04:57 +00:00
|
|
|
|
2002-06-23 04:50:49 +00:00
|
|
|
#--------------------------------------------------------
|
|
|
|
# Arch specific compiler optimization stuff should go here.
|
|
|
|
# Unless you want to override the defaults, do not set anything
|
2006-03-01 22:54:48 +00:00
|
|
|
# for OPTIMIZATIONS...
|
2002-06-23 04:50:49 +00:00
|
|
|
|
|
|
|
# use '-Os' optimization if available, else use -O2
|
2006-03-09 09:03:37 +00:00
|
|
|
OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-Os,-O2)
|
2002-06-23 04:50:49 +00:00
|
|
|
|
2006-01-15 14:04:57 +00:00
|
|
|
# gcc 2.95 exits with 0 for "unrecognized option"
|
2006-03-09 09:03:37 +00:00
|
|
|
CFLAGS_COMBINE+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
|
2006-03-01 22:54:48 +00:00
|
|
|
$(if $(call cc_ge,3,0),\
|
|
|
|
$(call check_gcc,CFLAGS_COMBINE,--combine,)))
|
2006-01-15 14:04:57 +00:00
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
OPTIMIZATIONS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
|
2006-03-01 22:54:48 +00:00
|
|
|
$(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,))
|
2006-01-27 15:45:56 +00:00
|
|
|
|
2006-03-01 22:54:48 +00:00
|
|
|
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795
|
2006-03-09 09:03:37 +00:00
|
|
|
#PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
|
2006-03-01 22:54:48 +00:00
|
|
|
# $(call check_gcc,PROG_CFLAGS,-fwhole-program,))
|
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--enable-new-dtags,)
|
|
|
|
#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--reduce-memory-overheads,)
|
|
|
|
#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--as-needed,)
|
|
|
|
#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--warn-shared-textrel,)
|
2006-03-01 22:54:48 +00:00
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
PROG_LDFLAGS+=$(call check_ld,PROG_LDFLAGS,--gc-sections,)
|
2006-01-27 15:45:56 +00:00
|
|
|
|
2002-06-23 04:50:49 +00:00
|
|
|
# Some nice architecture specific optimizations
|
2006-03-01 22:54:48 +00:00
|
|
|
ifeq ($(__TARGET_ARCH),arm)
|
|
|
|
OPTIMIZATIONS+=-fstrict-aliasing
|
|
|
|
endif # arm
|
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
OPTIMIZATIONS+=$(if $(call is_eq,$(__TARGET_ARCH),i386),\
|
2006-03-01 22:54:48 +00:00
|
|
|
$(call check_gcc,OPTIMIZATIONS,-march=i386,))
|
|
|
|
|
2006-03-03 20:31:33 +00:00
|
|
|
# gcc-4.0 and older seem to benefit from these
|
2006-03-09 09:03:37 +00:00
|
|
|
OPTIMIZATIONS+=$(if $(call cc_le,4,0),\
|
2006-03-01 22:54:48 +00:00
|
|
|
$(call check_gcc,OPTIMIZATIONS,-mpreferred-stack-boundary=2,)\
|
2006-03-03 17:57:50 +00:00
|
|
|
$(call check_gcc,OPTIMIZATIONS,-falign-functions=1 -falign-jumps=1 -falign-loops=1,\
|
2006-03-01 22:54:48 +00:00
|
|
|
-malign-functions=0 -malign-jumps=0 -malign-loops=0))
|
2006-01-15 14:04:57 +00:00
|
|
|
|
|
|
|
# gcc-4.1 and beyond seem to benefit from these
|
2006-03-01 22:54:48 +00:00
|
|
|
# turn off flags which hurt -Os
|
2006-03-09 09:03:37 +00:00
|
|
|
OPTIMIZATIONS+=$(if $(call cc_ge,4,1),\
|
2006-03-01 22:54:48 +00:00
|
|
|
$(call check_gcc,OPTIMIZATIONS,-fno-tree-loop-optimize,)\
|
|
|
|
$(call check_gcc,OPTIMIZATIONS,-fno-tree-dominator-opts,)\
|
|
|
|
$(call check_gcc,OPTIMIZATIONS,-fno-strength-reduce,)\
|
|
|
|
\
|
|
|
|
$(call check_gcc,OPTIMIZATIONS,-fno-branch-count-reg,))
|
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,)
|
2002-06-23 04:50:49 +00:00
|
|
|
|
2002-04-12 12:05:57 +00:00
|
|
|
#
|
|
|
|
#--------------------------------------------------------
|
|
|
|
# If you're going to do a lot of builds with a non-vanilla configuration,
|
|
|
|
# it makes sense to adjust parameters above, so you can type "make"
|
|
|
|
# by itself, instead of following it by the same half-dozen overrides
|
|
|
|
# every time. The stuff below, on the other hand, is probably less
|
|
|
|
# prone to casual user adjustment.
|
2004-03-15 08:29:22 +00:00
|
|
|
#
|
2002-04-12 12:05:57 +00:00
|
|
|
|
2006-03-01 22:54:48 +00:00
|
|
|
ifeq ($(CONFIG_LFS),y)
|
2002-04-12 12:05:57 +00:00
|
|
|
# For large file summit support
|
2002-09-22 12:09:44 +00:00
|
|
|
CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
2002-04-12 12:05:57 +00:00
|
|
|
endif
|
2006-03-01 22:54:48 +00:00
|
|
|
ifeq ($(CONFIG_DMALLOC),y)
|
2002-04-12 12:05:57 +00:00
|
|
|
# For testing mem leaks with dmalloc
|
|
|
|
CFLAGS+=-DDMALLOC
|
|
|
|
LIBRARIES:=-ldmalloc
|
|
|
|
else
|
2006-03-01 22:54:48 +00:00
|
|
|
ifeq ($(CONFIG_EFENCE),y)
|
2002-04-12 12:05:57 +00:00
|
|
|
LIBRARIES:=-lefence
|
|
|
|
endif
|
|
|
|
endif
|
2006-03-01 22:54:48 +00:00
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
LDFLAGS+=$(if $(call is_eq,$(CONFIG_DEBUG),y),$(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,))
|
2006-03-01 22:54:48 +00:00
|
|
|
ifeq ($(CONFIG_DEBUG),y)
|
2002-04-12 12:05:57 +00:00
|
|
|
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
|
|
|
|
else
|
2003-03-07 17:27:51 +00:00
|
|
|
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
|
2006-03-10 23:20:48 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(CONFIG_STRIP_BINARIES),y)
|
2005-07-31 22:11:33 +00:00
|
|
|
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
|
2006-03-10 23:20:48 +00:00
|
|
|
else
|
|
|
|
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
|
2002-04-12 12:05:57 +00:00
|
|
|
endif
|
2006-03-09 09:03:37 +00:00
|
|
|
PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_STATIC),y),\
|
2006-03-01 22:54:48 +00:00
|
|
|
$(call check_gcc,PROG_CFLAGS,-static,))
|
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
CFLAGS_SHARED+=$(call check_gcc,CFLAGS_SHARED,-shared,)
|
2006-01-31 11:29:22 +00:00
|
|
|
LIB_CFLAGS+=$(CFLAGS_SHARED)
|
2006-01-15 14:04:57 +00:00
|
|
|
|
2006-03-09 09:03:37 +00:00
|
|
|
CFLAGS_PIC+=$(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\
|
2006-03-01 22:54:48 +00:00
|
|
|
$(call check_gcc,CFLAGS_PIC,-fPIC,))
|
2006-03-09 09:03:37 +00:00
|
|
|
LIB_CFLAGS+=$(CFLAGS_PIC)
|
2001-10-24 05:26:42 +00:00
|
|
|
|
2006-03-01 22:54:48 +00:00
|
|
|
ifeq ($(CONFIG_SELINUX),y)
|
2005-10-05 07:40:46 +00:00
|
|
|
LIBRARIES += -lselinux
|
|
|
|
endif
|
|
|
|
|
2002-10-26 10:17:24 +00:00
|
|
|
ifeq ($(strip $(PREFIX)),)
|
2002-04-12 12:05:57 +00:00
|
|
|
PREFIX:=`pwd`/_install
|
|
|
|
endif
|
2001-10-24 05:26:42 +00:00
|
|
|
|
2002-04-12 12:05:57 +00:00
|
|
|
CFLAGS += $(CROSS_CFLAGS)
|
|
|
|
ifdef BB_INIT_SCRIPT
|
|
|
|
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
|
2001-10-24 05:26:42 +00:00
|
|
|
endif
|
|
|
|
|
2002-04-12 12:05:57 +00:00
|
|
|
# Put user-supplied flags at the end, where they
|
|
|
|
# have a chance of winning.
|
|
|
|
CFLAGS += $(CFLAGS_EXTRA)
|
2001-10-24 05:26:42 +00:00
|
|
|
|
2005-12-15 07:25:54 +00:00
|
|
|
#------------------------------------------------------------
|
|
|
|
# Installation options
|
|
|
|
ifeq ($(strip $(CONFIG_INSTALL_APPLET_HARDLINKS)),y)
|
|
|
|
INSTALL_OPTS=--hardlinks
|
|
|
|
endif
|
|
|
|
ifeq ($(strip $(CONFIG_INSTALL_APPLET_SYMLINKS)),y)
|
|
|
|
INSTALL_OPTS=--symlinks
|
|
|
|
endif
|
|
|
|
ifeq ($(strip $(CONFIG_INSTALL_APPLET_DONT)),y)
|
|
|
|
INSTALL_OPTS=
|
|
|
|
endif
|
|
|
|
|
2006-03-01 22:54:48 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------
|
|
|
|
# object extensions
|
|
|
|
|
|
|
|
# object potentially used in shared object
|
|
|
|
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
|
|
|
|
# single-object extension
|
|
|
|
os:=.os
|
|
|
|
# multi-object extension
|
|
|
|
om:=.osm
|
|
|
|
else
|
|
|
|
os:=.o
|
|
|
|
om:=.om
|
|
|
|
endif
|
|
|
|
|
2006-02-02 01:41:53 +00:00
|
|
|
#------------------------------------------------------------
|
|
|
|
# Make the output nice and tight
|
2006-03-01 22:54:48 +00:00
|
|
|
|
|
|
|
# for make V=2 and above, do print directory
|
|
|
|
ifneq ($(shell test -n "$(strip $(PACKAGE_BE_VERBOSE))" && test $(PACKAGE_BE_VERBOSE) -gt 1 ; echo $$?),0)
|
|
|
|
MAKEFLAGS += --no-print-directory
|
|
|
|
endif
|
|
|
|
|
|
|
|
export MAKEOVERRIDES
|
2006-02-02 01:41:53 +00:00
|
|
|
export MAKE_IS_SILENT=n
|
|
|
|
ifneq ($(findstring s,$(MAKEFLAGS)),)
|
|
|
|
export MAKE_IS_SILENT=y
|
|
|
|
DISP := sil
|
|
|
|
Q := @
|
|
|
|
else
|
|
|
|
ifneq ($(V)$(VERBOSE),)
|
|
|
|
DISP := ver
|
|
|
|
Q :=
|
|
|
|
else
|
|
|
|
DISP := pur
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2006-03-01 22:54:48 +00:00
|
|
|
define show_objs
|
|
|
|
$(subst $(top_builddir)/,,$(subst ../,,$@))
|
|
|
|
endef
|
|
|
|
pur_disp_compile.c = @echo " "CC $(show_objs) ;
|
|
|
|
pur_disp_compile.h = @echo " "HOSTCC $(show_objs) ;
|
|
|
|
pur_disp_strip = @echo " "STRIP $(show_objs) ;
|
|
|
|
pur_disp_link = @echo " "LINK $(show_objs) ;
|
|
|
|
pur_disp_link.h = @echo " "HOSTLINK $(show_objs) ;
|
|
|
|
pur_disp_ar = @echo " "AR $(ARFLAGS) $(show_objs) ;
|
|
|
|
pur_disp_gen = @echo " "GEN $@ ;
|
|
|
|
pur_disp_doc = @echo " "DOC $(subst docs/,,$@) ;
|
|
|
|
pur_disp_bin = @echo " "BIN $(show_objs) ;
|
|
|
|
sil_disp_compile.c = @
|
|
|
|
sil_disp_compile.h = @
|
|
|
|
sil_disp_strip = @
|
|
|
|
sil_disp_link = @
|
|
|
|
sil_disp_link.h = @
|
|
|
|
sil_disp_ar = @
|
|
|
|
sil_disp_gen = @
|
|
|
|
sil_disp_doc = @
|
|
|
|
sil_disp_bin = @
|
|
|
|
ver_disp_compile.c =
|
|
|
|
ver_disp_compile.h =
|
|
|
|
ver_disp_strip =
|
|
|
|
ver_disp_link =
|
|
|
|
ver_disp_link.h =
|
|
|
|
ver_disp_ar =
|
|
|
|
ver_disp_gen =
|
|
|
|
ver_disp_doc =
|
|
|
|
ver_disp_bin =
|
2006-02-02 01:41:53 +00:00
|
|
|
disp_compile.c = $($(DISP)_disp_compile.c)
|
|
|
|
disp_compile.h = $($(DISP)_disp_compile.h)
|
|
|
|
disp_strip = $($(DISP)_disp_strip)
|
|
|
|
disp_link = $($(DISP)_disp_link)
|
2006-03-01 22:54:48 +00:00
|
|
|
disp_link.h = $($(DISP)_disp_link.h)
|
2006-02-02 01:41:53 +00:00
|
|
|
disp_ar = $($(DISP)_disp_ar)
|
2006-03-01 22:54:48 +00:00
|
|
|
disp_gen = $($(DISP)_disp_gen)
|
|
|
|
disp_doc = $($(DISP)_disp_doc)
|
|
|
|
disp_bin = $($(DISP)_disp_bin)
|
|
|
|
# CFLAGS-dir == $(CFLAGS-$(notdir $(@D)))
|
|
|
|
# CFLAGS-dir-file.o == $(CFLAGS-$(notdir $(@D))-$(notdir $(@F)))
|
|
|
|
# CFLAGS-dir-file.c == $(CFLAGS-$(notdir $(<D))-$(notdir $(<F)))
|
|
|
|
# all prerequesites == $(foreach fil,$^,$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(fil))))-$(notdir $(fil))))
|
|
|
|
cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) -c -o $@ $< \
|
|
|
|
$(foreach f,$^,$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(f))))-$(notdir $(f)))) \
|
|
|
|
$(CFLAGS-$(notdir $(@D))-$(notdir $(@F))) \
|
|
|
|
$(CFLAGS-$(notdir $(@D)))
|
|
|
|
cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
|
2006-02-02 01:41:53 +00:00
|
|
|
cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
|
|
|
|
cmd_strip = $(STRIPCMD) $@
|
2006-03-01 22:54:48 +00:00
|
|
|
cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) $(LDFLAGS)
|
|
|
|
cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(HOST_LDFLAGS) $^ -o $@
|
2006-02-02 01:41:53 +00:00
|
|
|
cmd_ar = $(AR) $(ARFLAGS) $@ $^
|
2006-03-01 22:54:48 +00:00
|
|
|
compile.c = $(disp_compile.c) $(cmd_compile.c)
|
|
|
|
compile.m = $(disp_compile.c) $(cmd_compile.m)
|
|
|
|
compile.h = $(disp_compile.h) $(cmd_compile.h)
|
|
|
|
do_strip = $(disp_strip) $(cmd_strip)
|
|
|
|
do_link = $(disp_link) $(cmd_link)
|
|
|
|
do_link.h = $(disp_link.h) $(cmd_link.h)
|
|
|
|
do_ar = $(disp_ar) $(cmd_ar)
|
|
|
|
|
|
|
|
ifdef rules-mak-rules
|
|
|
|
.SUFFIXES: .c .S .o .os .om .osm .oS .so .a .s .i .E
|
|
|
|
|
|
|
|
# generic rules
|
|
|
|
%.o: ; $(compile.c)
|
|
|
|
%.os: ; $(compile.c) $(CFLAGS_PIC)
|
|
|
|
%.om: ; $(compile.m)
|
|
|
|
%.osm: ; $(compile.m) $(CFLAGS_PIC)
|
2006-03-09 09:03:37 +00:00
|
|
|
%.a: ; $(do_ar)
|
2006-03-01 22:54:48 +00:00
|
|
|
|
|
|
|
endif # rules-mak-rules
|
2006-02-02 01:41:53 +00:00
|
|
|
|
2002-04-12 12:05:57 +00:00
|
|
|
.PHONY: dummy
|
2006-03-01 22:54:48 +00:00
|
|
|
|