2002-04-12 17:35:57 +05:30
|
|
|
# Rules.make for busybox
|
|
|
|
#
|
2005-11-29 08:23:52 +05:30
|
|
|
# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
|
2002-04-12 17:35:57 +05:30
|
|
|
#
|
2005-11-29 08:23:52 +05:30
|
|
|
# Licensed under GPLv2, see the file LICENSE in this tarball for details.
|
2002-04-12 17:35:57 +05:30
|
|
|
#
|
|
|
|
|
2005-11-29 08:22:25 +05:30
|
|
|
# Pull in the user's busybox configuration
|
|
|
|
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
|
|
|
|
-include $(top_builddir)/.config
|
|
|
|
endif
|
|
|
|
|
2006-03-02 04:24:48 +05:30
|
|
|
ifeq ($(HAVE_DOT_CONFIG),y)
|
|
|
|
rules-mak-rules:=0
|
|
|
|
endif
|
|
|
|
|
2002-12-05 14:11:41 +05:30
|
|
|
#--------------------------------------------------------
|
2002-04-12 17:35:57 +05:30
|
|
|
PROG := busybox
|
2005-10-13 16:10:18 +05:30
|
|
|
MAJOR_VERSION :=1
|
|
|
|
MINOR_VERSION :=1
|
2006-01-19 14:52:39 +05:30
|
|
|
SUBLEVEL_VERSION:=1
|
|
|
|
EXTRAVERSION :=-pre0
|
2005-10-13 16:10:18 +05:30
|
|
|
VERSION :=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)$(EXTRAVERSION)
|
2002-04-12 17:35:57 +05:30
|
|
|
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
|
|
|
|
|
|
|
|
|
2002-12-05 14:11:41 +05:30
|
|
|
#--------------------------------------------------------
|
2002-04-12 17:35:57 +05:30
|
|
|
# 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 13:10:46 +05:30
|
|
|
# make CROSS=powerpc-linux- top_srcdir="$HOME/busybox" PREFIX=/mnt/app
|
2002-12-05 14:11:41 +05:30
|
|
|
#--------------------------------------------------------
|
2002-04-12 17:35:57 +05:30
|
|
|
|
2002-12-05 14:11:41 +05:30
|
|
|
# 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-02 04:24:48 +05:30
|
|
|
# your compiler is broken, you should not need to specify __TARGET_ARCH
|
2003-11-05 17:04:26 +05:30
|
|
|
CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
|
2006-03-02 04:24:48 +05:30
|
|
|
#")
|
2003-11-05 17:04:26 +05:30
|
|
|
CC = $(CROSS)gcc
|
|
|
|
AR = $(CROSS)ar
|
|
|
|
AS = $(CROSS)as
|
|
|
|
LD = $(CROSS)ld
|
|
|
|
NM = $(CROSS)nm
|
|
|
|
STRIP = $(CROSS)strip
|
|
|
|
CPP = $(CC) -E
|
2006-03-02 04:24:48 +05:30
|
|
|
SED ?= sed
|
|
|
|
AWK ?= awk
|
|
|
|
|
|
|
|
|
|
|
|
ifdef PACKAGE_BE_VERBOSE
|
|
|
|
PACKAGE_BE_VERBOSE := $(shell echo $(PACKAGE_BE_VERBOSE) | $(SED) "s/[[:alpha:]]*//g")
|
|
|
|
endif
|
2005-10-13 16:10:18 +05:30
|
|
|
|
2006-03-02 04:24:48 +05:30
|
|
|
# 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 17:35:57 +05:30
|
|
|
|
2002-12-05 14:11:41 +05:30
|
|
|
# What OS are you compiling busybox for? This allows you to include
|
|
|
|
# OS specific things, syscall overrides, etc.
|
2003-11-05 17:04:26 +05:30
|
|
|
TARGET_OS=linux
|
2002-12-05 14:11:41 +05:30
|
|
|
|
|
|
|
# Select the compiler needed to build binaries for your development system
|
2003-11-05 17:04:26 +05:30
|
|
|
HOSTCC = gcc
|
2002-12-17 03:25:39 +05:30
|
|
|
HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
|
2002-04-12 17:35:57 +05:30
|
|
|
|
2004-03-15 13:59:22 +05:30
|
|
|
# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
|
2003-01-14 14:42:39 +05:30
|
|
|
LC_ALL:= C
|
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
# initialize flags here
|
|
|
|
CFLAGS:=
|
|
|
|
CFLAGS_COMBINE:=
|
|
|
|
CFLAGS_PIC:=
|
|
|
|
LD_FLAGS:=
|
|
|
|
LIB_LDFLAGS:=
|
|
|
|
PROG_LDFLAGS:=
|
|
|
|
PROG_CFLAGS:=
|
|
|
|
OPTIMIZATIONS:=
|
|
|
|
|
2002-12-05 14:11:41 +05:30
|
|
|
# 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-02 04:24:48 +05:30
|
|
|
# For optimization overrides, it's better still to set OPTIMIZATIONS.
|
2002-12-05 14:11:41 +05:30
|
|
|
CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
|
2006-03-02 04:24:48 +05:30
|
|
|
#")
|
2004-03-15 13:59:22 +05:30
|
|
|
|
2002-04-12 17:35:57 +05:30
|
|
|
# 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 14:26:01 +05:30
|
|
|
# For other libraries, you are on your own. But these may (or may not) help...
|
2002-04-12 17:35:57 +05:30
|
|
|
#LDFLAGS+=-nostdlib
|
|
|
|
#LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc
|
2005-12-01 22:31:43 +05:30
|
|
|
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) -funsigned-char
|
2002-04-12 17:35:57 +05:30
|
|
|
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
|
|
|
|
|
2002-12-17 03:25:39 +05:30
|
|
|
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
|
2006-03-02 04:24:48 +05:30
|
|
|
CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include
|
2006-01-15 19:34:57 +05:30
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
ARFLAGS=cru
|
2002-04-12 17:35:57 +05:30
|
|
|
|
2005-12-13 17:22:46 +05:30
|
|
|
|
2006-03-02 04:24:48 +05:30
|
|
|
|
|
|
|
# Get the CC MAJOR/MINOR version
|
2005-12-13 17:22:46 +05:30
|
|
|
# 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-02 04:24:48 +05:30
|
|
|
# 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 14:11:41 +05:30
|
|
|
#--------------------------------------------------------
|
2005-09-26 21:31:43 +05:30
|
|
|
export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
|
2006-03-02 04:24:48 +05:30
|
|
|
|
|
|
|
# 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 10:20:49 +05:30
|
|
|
-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 14:11:41 +05:30
|
|
|
-e 's/mips-.*/mips/' \
|
|
|
|
-e 's/mipsel-.*/mipsel/' \
|
|
|
|
-e 's/cris.*/cris/' \
|
|
|
|
)
|
2003-11-05 17:04:26 +05:30
|
|
|
endif
|
2002-12-05 14:11:41 +05:30
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
CFLAGS+=$(call check_gcc,CFLAGS,-funsigned-char,)
|
|
|
|
CFLAGS+=$(call check_gcc,CFLAGS,-mmax-stack-frame=256,)
|
2006-01-15 19:34:57 +05:30
|
|
|
|
2002-06-23 10:20:49 +05:30
|
|
|
#--------------------------------------------------------
|
|
|
|
# Arch specific compiler optimization stuff should go here.
|
|
|
|
# Unless you want to override the defaults, do not set anything
|
2006-03-02 04:24:48 +05:30
|
|
|
# for OPTIMIZATIONS...
|
2002-06-23 10:20:49 +05:30
|
|
|
|
|
|
|
# use '-Os' optimization if available, else use -O2
|
2006-03-09 14:33:37 +05:30
|
|
|
OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-Os,-O2)
|
2002-06-23 10:20:49 +05:30
|
|
|
|
2006-01-15 19:34:57 +05:30
|
|
|
# gcc 2.95 exits with 0 for "unrecognized option"
|
2006-03-09 14:33:37 +05:30
|
|
|
CFLAGS_COMBINE+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
|
2006-03-02 04:24:48 +05:30
|
|
|
$(if $(call cc_ge,3,0),\
|
|
|
|
$(call check_gcc,CFLAGS_COMBINE,--combine,)))
|
2006-01-15 19:34:57 +05:30
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
OPTIMIZATIONS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
|
2006-03-02 04:24:48 +05:30
|
|
|
$(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,))
|
2006-01-27 21:15:56 +05:30
|
|
|
|
2006-03-02 04:24:48 +05:30
|
|
|
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795
|
2006-03-09 14:33:37 +05:30
|
|
|
#PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
|
2006-03-02 04:24:48 +05:30
|
|
|
# $(call check_gcc,PROG_CFLAGS,-fwhole-program,))
|
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
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-02 04:24:48 +05:30
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
PROG_LDFLAGS+=$(call check_ld,PROG_LDFLAGS,--gc-sections,)
|
2006-01-27 21:15:56 +05:30
|
|
|
|
2002-06-23 10:20:49 +05:30
|
|
|
# Some nice architecture specific optimizations
|
2006-03-02 04:24:48 +05:30
|
|
|
ifeq ($(__TARGET_ARCH),arm)
|
|
|
|
OPTIMIZATIONS+=-fstrict-aliasing
|
|
|
|
endif # arm
|
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
OPTIMIZATIONS+=$(if $(call is_eq,$(__TARGET_ARCH),i386),\
|
2006-03-02 04:24:48 +05:30
|
|
|
$(call check_gcc,OPTIMIZATIONS,-march=i386,))
|
|
|
|
|
2006-03-04 02:01:33 +05:30
|
|
|
# gcc-4.0 and older seem to benefit from these
|
2006-03-09 14:33:37 +05:30
|
|
|
OPTIMIZATIONS+=$(if $(call cc_le,4,0),\
|
2006-03-02 04:24:48 +05:30
|
|
|
$(call check_gcc,OPTIMIZATIONS,-mpreferred-stack-boundary=2,)\
|
2006-03-03 23:27:50 +05:30
|
|
|
$(call check_gcc,OPTIMIZATIONS,-falign-functions=1 -falign-jumps=1 -falign-loops=1,\
|
2006-03-02 04:24:48 +05:30
|
|
|
-malign-functions=0 -malign-jumps=0 -malign-loops=0))
|
2006-01-15 19:34:57 +05:30
|
|
|
|
|
|
|
# gcc-4.1 and beyond seem to benefit from these
|
2006-03-02 04:24:48 +05:30
|
|
|
# turn off flags which hurt -Os
|
2006-03-09 14:33:37 +05:30
|
|
|
OPTIMIZATIONS+=$(if $(call cc_ge,4,1),\
|
2006-03-02 04:24:48 +05:30
|
|
|
$(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 14:33:37 +05:30
|
|
|
OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,)
|
2002-06-23 10:20:49 +05:30
|
|
|
|
2002-04-12 17:35:57 +05:30
|
|
|
#
|
|
|
|
#--------------------------------------------------------
|
|
|
|
# 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 13:59:22 +05:30
|
|
|
#
|
2002-04-12 17:35:57 +05:30
|
|
|
|
2006-03-02 04:24:48 +05:30
|
|
|
ifeq ($(CONFIG_LFS),y)
|
2002-04-12 17:35:57 +05:30
|
|
|
# For large file summit support
|
2002-09-22 17:39:44 +05:30
|
|
|
CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
2002-04-12 17:35:57 +05:30
|
|
|
endif
|
2006-03-02 04:24:48 +05:30
|
|
|
ifeq ($(CONFIG_DMALLOC),y)
|
2002-04-12 17:35:57 +05:30
|
|
|
# For testing mem leaks with dmalloc
|
|
|
|
CFLAGS+=-DDMALLOC
|
|
|
|
LIBRARIES:=-ldmalloc
|
|
|
|
else
|
2006-03-02 04:24:48 +05:30
|
|
|
ifeq ($(CONFIG_EFENCE),y)
|
2002-04-12 17:35:57 +05:30
|
|
|
LIBRARIES:=-lefence
|
|
|
|
endif
|
|
|
|
endif
|
2006-03-02 04:24:48 +05:30
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
LDFLAGS+=$(if $(call is_eq,$(CONFIG_DEBUG),y),$(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,))
|
2006-03-02 04:24:48 +05:30
|
|
|
ifeq ($(CONFIG_DEBUG),y)
|
2002-04-12 17:35:57 +05:30
|
|
|
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
|
|
|
|
else
|
2003-03-07 22:57:51 +05:30
|
|
|
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
|
2006-03-11 04:50:48 +05:30
|
|
|
endif
|
|
|
|
ifeq ($(CONFIG_STRIP_BINARIES),y)
|
2005-08-01 03:41:33 +05:30
|
|
|
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
|
2006-03-11 04:50:48 +05:30
|
|
|
else
|
|
|
|
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
|
2002-04-12 17:35:57 +05:30
|
|
|
endif
|
2006-03-09 14:33:37 +05:30
|
|
|
PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_STATIC),y),\
|
2006-03-02 04:24:48 +05:30
|
|
|
$(call check_gcc,PROG_CFLAGS,-static,))
|
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
CFLAGS_SHARED+=$(call check_gcc,CFLAGS_SHARED,-shared,)
|
2006-01-31 16:59:22 +05:30
|
|
|
LIB_CFLAGS+=$(CFLAGS_SHARED)
|
2006-01-15 19:34:57 +05:30
|
|
|
|
2006-03-09 14:33:37 +05:30
|
|
|
CFLAGS_PIC+=$(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\
|
2006-03-02 04:24:48 +05:30
|
|
|
$(call check_gcc,CFLAGS_PIC,-fPIC,))
|
2006-03-09 14:33:37 +05:30
|
|
|
LIB_CFLAGS+=$(CFLAGS_PIC)
|
2001-10-24 10:56:42 +05:30
|
|
|
|
2006-03-02 04:24:48 +05:30
|
|
|
ifeq ($(CONFIG_SELINUX),y)
|
2005-10-05 13:10:46 +05:30
|
|
|
LIBRARIES += -lselinux
|
|
|
|
endif
|
|
|
|
|
2002-10-26 15:47:24 +05:30
|
|
|
ifeq ($(strip $(PREFIX)),)
|
2002-04-12 17:35:57 +05:30
|
|
|
PREFIX:=`pwd`/_install
|
|
|
|
endif
|
2001-10-24 10:56:42 +05:30
|
|
|
|
2002-04-12 17:35:57 +05:30
|
|
|
CFLAGS += $(CROSS_CFLAGS)
|
|
|
|
ifdef BB_INIT_SCRIPT
|
|
|
|
CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"'
|
2001-10-24 10:56:42 +05:30
|
|
|
endif
|
|
|
|
|
2002-04-12 17:35:57 +05:30
|
|
|
# Put user-supplied flags at the end, where they
|
|
|
|
# have a chance of winning.
|
|
|
|
CFLAGS += $(CFLAGS_EXTRA)
|
2001-10-24 10:56:42 +05:30
|
|
|
|
2005-12-15 12:55:54 +05:30
|
|
|
#------------------------------------------------------------
|
|
|
|
# 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-02 04:24:48 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------
|
|
|
|
# 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 07:11:53 +05:30
|
|
|
#------------------------------------------------------------
|
|
|
|
# Make the output nice and tight
|
2006-03-02 04:24:48 +05:30
|
|
|
|
|
|
|
# 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 07:11:53 +05:30
|
|
|
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-02 04:24:48 +05:30
|
|
|
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 07:11:53 +05:30
|
|
|
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-02 04:24:48 +05:30
|
|
|
disp_link.h = $($(DISP)_disp_link.h)
|
2006-02-02 07:11:53 +05:30
|
|
|
disp_ar = $($(DISP)_disp_ar)
|
2006-03-02 04:24:48 +05:30
|
|
|
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 07:11:53 +05:30
|
|
|
cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
|
|
|
|
cmd_strip = $(STRIPCMD) $@
|
2006-03-02 04:24:48 +05:30
|
|
|
cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) $(LDFLAGS)
|
|
|
|
cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(HOST_LDFLAGS) $^ -o $@
|
2006-02-02 07:11:53 +05:30
|
|
|
cmd_ar = $(AR) $(ARFLAGS) $@ $^
|
2006-03-02 04:24:48 +05:30
|
|
|
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 14:33:37 +05:30
|
|
|
%.a: ; $(do_ar)
|
2006-03-02 04:24:48 +05:30
|
|
|
|
|
|
|
endif # rules-mak-rules
|
2006-02-02 07:11:53 +05:30
|
|
|
|
2002-04-12 17:35:57 +05:30
|
|
|
.PHONY: dummy
|
2006-03-02 04:24:48 +05:30
|
|
|
|