Add .PHONY targets for phony targets

We have a bunch of manual dependency targets. They need to be marked as
.PHONY so that they'll always work.

Also made the spacing around the ':' more consistent so it's easier to find
specific instances.

BUG=chromium-os:26317
BRANCH=none
TEST=manual

sudo emerge vboot_reference
emerge-link vboot_reference chromeos-u-boot chromeos-installer
emerge-daisy vboot_reference chromeos-u-boot chromeos-installer

Change-Id: I00a1b8abcd588bdbab33b172c64a4b305b6d7237
Reviewed-on: https://gerrit.chromium.org/gerrit/41185
Commit-Queue: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Bill Richardson
2013-01-11 22:53:00 -08:00
committed by ChromeBot
parent 3428b4bcd9
commit acb2ee977b

138
Makefile
View File

@@ -133,19 +133,24 @@ _dir_create := $(foreach d, \
$(shell [ -d $(BUILD)/$(d) ] || mkdir -p $(BUILD)/$(d))) $(shell [ -d $(BUILD)/$(d) ] || mkdir -p $(BUILD)/$(d)))
# First target # First target
.PHONY: all
all: fwlib $(if $(FIRMWARE_ARCH),,host_stuff) all: fwlib $(if $(FIRMWARE_ARCH),,host_stuff)
# Host targets # Host targets
.PHONY: host_stuff
host_stuff: fwlib hostlib cgpt utils tests host_stuff: fwlib hostlib cgpt utils tests
.PHONY: clean
clean: clean:
$(Q)/bin/rm -rf ${BUILD} $(Q)/bin/rm -rf ${BUILD}
.PHONY: install
install: cgpt_install utils_install install: cgpt_install utils_install
# Coverage # Coverage
COV_INFO = $(BUILD)/coverage.info COV_INFO = $(BUILD)/coverage.info
#coverage: runtests #coverage: runtests
.PHONY: coverage
coverage: coverage:
rm -f $(COV_INFO)* rm -f $(COV_INFO)*
lcov --capture --directory . --base-directory . -o $(COV_INFO).1 lcov --capture --directory . --base-directory . -o $(COV_INFO).1
@@ -169,7 +174,7 @@ coverage:
# TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until # TPM_BLOCKING_CONTINUESELFTEST is defined if TPM_ContinueSelfTest blocks until
# the self test has completed. # the self test has completed.
$(FWLIB) : CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST $(FWLIB): CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST
# TPM_MANUAL_SELFTEST is defined if the self test must be started manually # TPM_MANUAL_SELFTEST is defined if the self test must be started manually
# (with a call to TPM_ContinueSelfTest) instead of starting automatically at # (with a call to TPM_ContinueSelfTest) instead of starting automatically at
@@ -182,18 +187,18 @@ $(FWLIB) : CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST
ifeq ($(FIRMWARE_ARCH),i386) ifeq ($(FIRMWARE_ARCH),i386)
# Unrolling loops in cryptolib makes it faster # Unrolling loops in cryptolib makes it faster
$(FWLIB) : CFLAGS += -DUNROLL_LOOPS $(FWLIB): CFLAGS += -DUNROLL_LOOPS
# Workaround for coreboot on x86, which will power off asynchronously # Workaround for coreboot on x86, which will power off asynchronously
# without giving us a chance to react. This is not an example of the Right # without giving us a chance to react. This is not an example of the Right
# Way to do things. See chrome-os-partner:7689, and the commit message # Way to do things. See chrome-os-partner:7689, and the commit message
# that made this change. # that made this change.
$(FWLIB) : CFLAGS += -DSAVE_LOCALE_IMMEDIATELY $(FWLIB): CFLAGS += -DSAVE_LOCALE_IMMEDIATELY
# On x86 we don't actually read the GBB data into RAM until it is needed. # On x86 we don't actually read the GBB data into RAM until it is needed.
# Therefore it makes sense to cache it rather than reading it each time. # Therefore it makes sense to cache it rather than reading it each time.
# Enable this feature. # Enable this feature.
$(FWLIB) : CFLAGS += -DCOPY_BMP_DATA $(FWLIB): CFLAGS += -DCOPY_BMP_DATA
endif endif
ifeq ($(FIRMWARE_ARCH),) ifeq ($(FIRMWARE_ARCH),)
@@ -201,7 +206,7 @@ $(warning FIRMWARE_ARCH not defined; assuming local compile)
# Disable rollback TPM when compiling locally, since otherwise # Disable rollback TPM when compiling locally, since otherwise
# load_kernel_test attempts to talk to the TPM. # load_kernel_test attempts to talk to the TPM.
$(FWLIB) : CFLAGS += -DDISABLE_ROLLBACK_TPM $(FWLIB): CFLAGS += -DDISABLE_ROLLBACK_TPM
endif endif
# find lib -iname '*.c' | sort # find lib -iname '*.c' | sort
@@ -254,16 +259,17 @@ endif
FWLIB_OBJS = $(FWLIB_SRCS:%.c=${BUILD}/%.o) FWLIB_OBJS = $(FWLIB_SRCS:%.c=${BUILD}/%.o)
ALL_OBJS += ${FWLIB_OBJS} ALL_OBJS += ${FWLIB_OBJS}
.PHONY: fwlib
ifeq ($(FIRMWARE_ARCH),) ifeq ($(FIRMWARE_ARCH),)
# Link test ensures firmware lib doesn't rely on outside libraries # Link test ensures firmware lib doesn't rely on outside libraries
${BUILD}/firmware/linktest/main : LIBS = $(FWLIB) ${BUILD}/firmware/linktest/main: LIBS = $(FWLIB)
fwlib : ${BUILD}/firmware/linktest/main fwlib: ${BUILD}/firmware/linktest/main
else else
fwlib : $(FWLIB) fwlib: $(FWLIB)
endif endif
$(FWLIB) : $(FWLIB_OBJS) $(FWLIB): $(FWLIB_OBJS)
@printf " RM $(subst $(BUILD)/,,$(@))\n" @printf " RM $(subst $(BUILD)/,,$(@))\n"
$(Q)rm -f $@ $(Q)rm -f $@
@printf " AR $(subst $(BUILD)/,,$(@))\n" @printf " AR $(subst $(BUILD)/,,$(@))\n"
@@ -272,9 +278,10 @@ $(FWLIB) : $(FWLIB_OBJS)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Host library # Host library
hostlib : $(HOSTLIB) ${BUILD}/host/linktest/main .PHONY: hostlib
hostlib: $(HOSTLIB) ${BUILD}/host/linktest/main
${BUILD}/host/% ${HOSTLIB} : INCLUDES += \ ${BUILD}/host/% ${HOSTLIB}: INCLUDES += \
-Ihost/include\ -Ihost/include\
-Ihost/arch/$(ARCH)/include -Ihost/arch/$(ARCH)/include
@@ -294,7 +301,7 @@ HOSTLIB_OBJS = $(HOSTLIB_SRCS:%.c=${BUILD}/%.o)
ALL_OBJS += ${HOSTLIB_OBJS} ALL_OBJS += ${HOSTLIB_OBJS}
# TODO: better way to make .a than duplicating this recipe each time? # TODO: better way to make .a than duplicating this recipe each time?
$(HOSTLIB) : $(HOSTLIB_OBJS) $(FWLIB_OBJS) $(HOSTLIB): $(HOSTLIB_OBJS) $(FWLIB_OBJS)
@printf " RM $(subst $(BUILD)/,,$(@))\n" @printf " RM $(subst $(BUILD)/,,$(@))\n"
$(Q)rm -f $@ $(Q)rm -f $@
@printf " AR $(subst $(BUILD)/,,$(@))\n" @printf " AR $(subst $(BUILD)/,,$(@))\n"
@@ -350,25 +357,27 @@ CGPTLIB_OBJS = $(filter %.o, \
$(CGPTLIB_SRCS:%.cc=${BUILD}/%.o)) $(CGPTLIB_SRCS:%.cc=${BUILD}/%.o))
ALL_OBJS += $(CGPTLIB_OBJS) ALL_OBJS += $(CGPTLIB_OBJS)
cgpt : $(CGPT)
.PHONY: cgpt .PHONY: cgpt
cgpt: $(CGPT)
libcgpt_cc : $(CGPTLIB) .PHONY: libcgpt_cc
libcgpt_cc: $(CGPTLIB)
$(CGPTLIB) : INCLUDES += -Ifirmware/lib/cgptlib/include $(CGPTLIB): INCLUDES += -Ifirmware/lib/cgptlib/include
$(CGPTLIB) : $(CGPTLIB_OBJS) $(CGPTLIB): $(CGPTLIB_OBJS)
@printf " RM $(subst $(BUILD)/,,$(@))\n" @printf " RM $(subst $(BUILD)/,,$(@))\n"
$(Q)rm -f $@ $(Q)rm -f $@
@printf " AR $(subst $(BUILD)/,,$(@))\n" @printf " AR $(subst $(BUILD)/,,$(@))\n"
$(Q)ar qc $@ $^ $(Q)ar qc $@ $^
$(CGPT) : INCLUDES += -Ifirmware/lib/cgptlib/include $(CGPT): INCLUDES += -Ifirmware/lib/cgptlib/include
$(CGPT) : LDLIBS = -luuid $(CGPT): LDLIBS = -luuid
$(CGPT) : LDFLAGS += -static $(CGPT): LDFLAGS += -static
$(CGPT) : $(CGPT_OBJS) $$(LIBS) $(CGPT): $(CGPT_OBJS) $$(LIBS)
@printf " LDcgpt $(subst $(BUILD)/,,$(@))\n" @printf " LDcgpt $(subst $(BUILD)/,,$(@))\n"
$(Q)$(LD) -o $(CGPT) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) $(LDLIBS) $(Q)$(LD) -o $(CGPT) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) $(LDLIBS)
.PHONY: cgpt_install
cgpt_install: $(CGPT) cgpt_install: $(CGPT)
mkdir -p $(DESTDIR) mkdir -p $(DESTDIR)
cp -f $^ $(DESTDIR) cp -f $^ $(DESTDIR)
@@ -377,19 +386,19 @@ cgpt_install: $(CGPT)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Utilities # Utilities
${BUILD}/utility/% : INCLUDES += -Ihost/include -Iutility/include ${BUILD}/utility/%: INCLUDES += -Ihost/include -Iutility/include
${BUILD}/utility/% : CFLAGS += $(PC_CFLAGS) ${BUILD}/utility/%: CFLAGS += $(PC_CFLAGS)
AU_NAMES = \ AU_NAMES = \
crossystem \ crossystem \
dump_fmap \ dump_fmap \
gbb_utility gbb_utility
AU_BINS := $(addprefix ${BUILD}/utility/,$(AU_NAMES)) AU_BINS:= $(addprefix ${BUILD}/utility/,$(AU_NAMES))
# Utilities for auto-update toolkits must be statically linked, and don't # Utilities for auto-update toolkits must be statically linked, and don't
# use the crypto libs. # use the crypto libs.
${AU_BINS} : LDFLAGS += -static ${AU_BINS}: LDFLAGS += -static
${AU_BINS} : CRYPTO_LIBS = ${AU_BINS}: CRYPTO_LIBS =
# Scripts to install # Scripts to install
UTIL_SCRIPTS = \ UTIL_SCRIPTS = \
@@ -429,26 +438,28 @@ endif
UTIL_BINS = $(addprefix ${BUILD}/utility/,$(UTIL_NAMES)) UTIL_BINS = $(addprefix ${BUILD}/utility/,$(UTIL_NAMES))
ALL_DEPS += $(addsuffix .d,${UTIL_BINS}) ALL_DEPS += $(addsuffix .d,${UTIL_BINS})
utils : $(UTIL_BINS) $(UTIL_SCRIPTS) .PHONY: utils
utils: $(UTIL_BINS) $(UTIL_SCRIPTS)
# TODO: change ebuild to pull scripts directly out of utility dir # TODO: change ebuild to pull scripts directly out of utility dir
$(Q)cp -f $(UTIL_SCRIPTS) $(BUILD)/utility $(Q)cp -f $(UTIL_SCRIPTS) $(BUILD)/utility
$(Q)chmod a+rx $(patsubst %,$(BUILD)/%,$(UTIL_SCRIPTS)) $(Q)chmod a+rx $(patsubst %,$(BUILD)/%,$(UTIL_SCRIPTS))
utils_install : $(UTIL_BINS) $(UTIL_SCRIPTS) .PHONY: utils_install
utils_install: $(UTIL_BINS) $(UTIL_SCRIPTS)
mkdir -p $(DESTDIR) mkdir -p $(DESTDIR)
cp -f $(UTIL_BINS) $(DESTDIR) cp -f $(UTIL_BINS) $(DESTDIR)
chmod a+rx $(patsubst %,$(DESTDIR)/%,$(UTIL_NAMES)) chmod a+rx $(patsubst %,$(DESTDIR)/%,$(UTIL_NAMES))
cp -f $(UTIL_SCRIPTS) $(DESTDIR) cp -f $(UTIL_SCRIPTS) $(DESTDIR)
chmod a+rx $(patsubst utility/%,$(DESTDIR)/%,$(UTIL_SCRIPTS)) chmod a+rx $(patsubst utility/%,$(DESTDIR)/%,$(UTIL_SCRIPTS))
${BUILD}/utility/dump_kernel_config : LIBS += $(DUMPKERNELCONFIGLIB) ${BUILD}/utility/dump_kernel_config: LIBS += $(DUMPKERNELCONFIGLIB)
# GBB utility needs C++ linker # GBB utility needs C++ linker
${BUILD}/utility/gbb_utility : LD = $(CXX) ${BUILD}/utility/gbb_utility: LD = $(CXX)
${BUILD}/utility/bmpblk_utility : LD = $(CXX) ${BUILD}/utility/bmpblk_utility: LD = $(CXX)
${BUILD}/utility/bmpblk_utility : LDLIBS = -llzma -lyaml ${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml
${BUILD}/utility/bmpblk_utility : OBJS = \ ${BUILD}/utility/bmpblk_utility: OBJS = \
${BUILD}/utility/bmpblk_util.o \ ${BUILD}/utility/bmpblk_util.o \
${BUILD}/utility/image_types.o \ ${BUILD}/utility/image_types.o \
${BUILD}/utility/eficompress_for_lib.o \ ${BUILD}/utility/eficompress_for_lib.o \
@@ -499,12 +510,13 @@ endif
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Utility to generate TLCL structure definition header file. # Utility to generate TLCL structure definition header file.
${BUILD}/utility/tlcl_generator : CFLAGS += -fpack-struct ${BUILD}/utility/tlcl_generator: CFLAGS += -fpack-struct
${BUILD}/utility/tlcl_generator : LIBS = ${BUILD}/utility/tlcl_generator: LIBS =
STRUCTURES_TMP=${BUILD}/tlcl_structures.tmp STRUCTURES_TMP=${BUILD}/tlcl_structures.tmp
STRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h STRUCTURES_SRC=firmware/lib/tpm_lite/include/tlcl_structures.h
.PHONY: update_tlcl_structures
update_tlcl_structures: ${BUILD}/utility/tlcl_generator update_tlcl_structures: ${BUILD}/utility/tlcl_generator
@printf " Rebuilding TLCL structures\n" @printf " Rebuilding TLCL structures\n"
$(Q)${BUILD}/utility/tlcl_generator > $(STRUCTURES_TMP) $(Q)${BUILD}/utility/tlcl_generator > $(STRUCTURES_TMP)
@@ -516,9 +528,10 @@ update_tlcl_structures: ${BUILD}/utility/tlcl_generator
# Library to dump kernel config # Library to dump kernel config
# Used by platform/installer # Used by platform/installer
.PHONY: libdump_kernel_config
libdump_kernel_config: $(DUMPKERNELCONFIGLIB) libdump_kernel_config: $(DUMPKERNELCONFIGLIB)
$(DUMPKERNELCONFIGLIB) : ${BUILD}/utility/dump_kernel_config_lib.o $(DUMPKERNELCONFIGLIB): ${BUILD}/utility/dump_kernel_config_lib.o
@printf " RM $(subst $(BUILD)/,,$(@))\n" @printf " RM $(subst $(BUILD)/,,$(@))\n"
$(Q)rm -f $@ $(Q)rm -f $@
@printf " AR $(subst $(BUILD)/,,$(@))\n" @printf " AR $(subst $(BUILD)/,,$(@))\n"
@@ -528,10 +541,10 @@ $(DUMPKERNELCONFIGLIB) : ${BUILD}/utility/dump_kernel_config_lib.o
# Tests # Tests
# Allow multiple definitions, so tests can mock functions from other libraries # Allow multiple definitions, so tests can mock functions from other libraries
${BUILD}/tests/% : CFLAGS += -Xlinker --allow-multiple-definition ${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition
${BUILD}/tests/% : INCLUDES += -Ihost/include ${BUILD}/tests/%: INCLUDES += -Ihost/include
${BUILD}/tests/% : LDLIBS += -lrt -luuid ${BUILD}/tests/%: LDLIBS += -lrt -luuid
${BUILD}/tests/% : LIBS += $(TEST_LIB) ${BUILD}/tests/%: LIBS += $(TEST_LIB)
TEST_NAMES = \ TEST_NAMES = \
cgptlib_test \ cgptlib_test \
@@ -578,8 +591,8 @@ TEST_NAMES += $(addprefix tpm_lite/,$(TLCL_TEST_NAMES))
TEST_BINS = $(addprefix ${BUILD}/tests/,$(TEST_NAMES)) TEST_BINS = $(addprefix ${BUILD}/tests/,$(TEST_NAMES))
ALL_DEPS += $(addsuffix .d,${TEST_BINS}) ALL_DEPS += $(addsuffix .d,${TEST_BINS})
tests : $(TEST_BINS)
.PHONY: tests .PHONY: tests
tests: $(TEST_BINS)
${TEST_LIB}: \ ${TEST_LIB}: \
${BUILD}/tests/test_common.o \ ${BUILD}/tests/test_common.o \
@@ -596,17 +609,18 @@ ${BUILD}/tests/rollback_index2_tests: OBJS += \
${BUILD}/tests/vboot_audio_tests: OBJS += \ ${BUILD}/tests/vboot_audio_tests: OBJS += \
${BUILD}/firmware/lib/vboot_audio_for_test.o ${BUILD}/firmware/lib/vboot_audio_for_test.o
.PHONY: cgptmanager_tests
cgptmanager_tests: ${BUILD}/tests/CgptManagerTests cgptmanager_tests: ${BUILD}/tests/CgptManagerTests
${BUILD}/tests/CgptManagerTests : CFLAGS += $(PC_CFLAGS) ${BUILD}/tests/CgptManagerTests: CFLAGS += $(PC_CFLAGS)
${BUILD}/tests/CgptManagerTests : LD = $(CXX) ${BUILD}/tests/CgptManagerTests: LD = $(CXX)
${BUILD}/tests/CgptManagerTests : LDLIBS += -lgtest -lgflags $(PC_LDLIBS) ${BUILD}/tests/CgptManagerTests: LDLIBS += -lgtest -lgflags $(PC_LDLIBS)
${BUILD}/tests/CgptManagerTests : LIBS = $(CGPTLIB) ${BUILD}/tests/CgptManagerTests: LIBS = $(CGPTLIB)
${BUILD}/tests/rollback_index_test : INCLUDES += -I/usr/include ${BUILD}/tests/rollback_index_test: INCLUDES += -I/usr/include
${BUILD}/tests/rollback_index_test : LIBS += -ltlcl ${BUILD}/tests/rollback_index_test: LIBS += -ltlcl
${BUILD}/tests/tpm_lite/tpmtest_% : OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o ${BUILD}/tests/tpm_lite/tpmtest_%: OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o
# TODO: port these tests to new API, if not already eqivalent # TODO: port these tests to new API, if not already eqivalent
# functionality in other tests. These don't even compile at present. # functionality in other tests. These don't even compile at present.
@@ -629,21 +643,26 @@ ${BUILD}/tests/tpm_lite/tpmtest_% : OBJS += ${BUILD}/tests/tpm_lite/tlcl_tests.o
# Targets to run tests # Targets to run tests
# Frequently-run tests # Frequently-run tests
runtests : runbmptests runcgpttests runfuzztests runmisctests .PHONY: runtests
runtests: runbmptests runcgpttests runfuzztests runmisctests
# Generate test keys # Generate test keys
.PHONY: genkeys
genkeys: genkeys:
tests/gen_test_keys.sh tests/gen_test_keys.sh
# Generate test cases for fuzzing # Generate test cases for fuzzing
.PHONY: genfuzztestcases
genfuzztestcases: genfuzztestcases:
tests/gen_fuzz_test_cases.sh tests/gen_fuzz_test_cases.sh
.PHONY: runbmptests
runbmptests: utils runbmptests: utils
cd tests/bitmaps && BMPBLK=${BUILD}/utility/bmpblk_utility \ cd tests/bitmaps && BMPBLK=${BUILD}/utility/bmpblk_utility \
./TestBmpBlock.py -v ./TestBmpBlock.py -v
runcgpttests : cgpt tests .PHONY: runcgpttests
runcgpttests: cgpt tests
${BUILD}/tests/cgptlib_test ${BUILD}/tests/cgptlib_test
tests/run_cgpt_tests.sh ${BUILD}/cgpt/cgpt tests/run_cgpt_tests.sh ${BUILD}/cgpt/cgpt
ifneq ($(IN_CHROOT),) ifneq ($(IN_CHROOT),)
@@ -651,11 +670,13 @@ ifneq ($(IN_CHROOT),)
endif endif
# Exercise vbutil_kernel and vbutil_firmware # Exercise vbutil_kernel and vbutil_firmware
.PHONY: runfuzztests
runfuzztests: genfuzztestcases utils tests runfuzztests: genfuzztestcases utils tests
tests/run_preamble_tests.sh tests/run_preamble_tests.sh
tests/run_vbutil_kernel_arg_tests.sh tests/run_vbutil_kernel_arg_tests.sh
runmisctests : tests utils .PHONY: runmisctests
runmisctests: tests utils
${BUILD}/tests/rollback_index2_tests ${BUILD}/tests/rollback_index2_tests
${BUILD}/tests/rsa_utility_tests ${BUILD}/tests/rsa_utility_tests
${BUILD}/tests/sha_tests ${BUILD}/tests/sha_tests
@@ -675,7 +696,8 @@ runmisctests : tests utils
# Run long tests, including all permutations of encryption keys (instead of # Run long tests, including all permutations of encryption keys (instead of
# just the ones we use) and tests of currently-unused code (e.g. vboot_ec). # just the ones we use) and tests of currently-unused code (e.g. vboot_ec).
# Not run by automated build. # Not run by automated build.
runlongtests : genkeys genfuzztestcases tests utils .PHONY: runlongtests
runlongtests: genkeys genfuzztestcases tests utils
tests/run_preamble_tests.sh --all tests/run_preamble_tests.sh --all
tests/run_vboot_common_tests.sh --all tests/run_vboot_common_tests.sh --all
tests/run_vboot_ec_tests.sh tests/run_vboot_ec_tests.sh
@@ -693,28 +715,28 @@ runlongtests : genkeys genfuzztestcases tests utils
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Build rules # Build rules
${BUILD}/% : ${BUILD}/%.o $$(OBJS) $$(LIBS) ${BUILD}/%: ${BUILD}/%.o $$(OBJS) $$(LIBS)
@printf " LD $(subst $(BUILD)/,,$(@))\n" @printf " LD $(subst $(BUILD)/,,$(@))\n"
$(Q)$(LD) $(CFLAGS) $(INCLUDES) $(LDFLAGS) $< $(OBJS) -o $@ \ $(Q)$(LD) $(CFLAGS) $(INCLUDES) $(LDFLAGS) $< $(OBJS) -o $@ \
$(LIBS) $(LDLIBS) $(LIBS) $(LDLIBS)
${BUILD}/%.o : %.c ${BUILD}/%.o: %.c
@printf " CC $(subst $(BUILD)/,,$(@))\n" @printf " CC $(subst $(BUILD)/,,$(@))\n"
$(Q)$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< $(Q)$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
# Rules to recompile a single source file for library and test # Rules to recompile a single source file for library and test
# TODO: is there a tidier way to do this? # TODO: is there a tidier way to do this?
${BUILD}/%_for_lib.o : CFLAGS += -DFOR_LIBRARY ${BUILD}/%_for_lib.o: CFLAGS += -DFOR_LIBRARY
${BUILD}/%_for_lib.o : %.c ${BUILD}/%_for_lib.o: %.c
@printf " CC-for-lib $(subst $(BUILD)/,,$(@))\n" @printf " CC-for-lib $(subst $(BUILD)/,,$(@))\n"
$(Q)$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< $(Q)$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
${BUILD}/%_for_test.o : CFLAGS += -DFOR_TEST ${BUILD}/%_for_test.o: CFLAGS += -DFOR_TEST
${BUILD}/%_for_test.o : %.c ${BUILD}/%_for_test.o: %.c
@printf " CC-for-test $(subst $(BUILD)/,,$(@))\n" @printf " CC-for-test $(subst $(BUILD)/,,$(@))\n"
$(Q)$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< $(Q)$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
# TODO: C++ files don't belong in vboot reference at all. Convert to C. # TODO: C++ files don't belong in vboot reference at all. Convert to C.
${BUILD}/%.o : %.cc ${BUILD}/%.o: %.cc
@printf " CXX $(subst $(BUILD)/,,$(@))\n" @printf " CXX $(subst $(BUILD)/,,$(@))\n"
$(Q)$(CXX) $(CFLAGS) $(INCLUDES) -c -o $@ $< $(Q)$(CXX) $(CFLAGS) $(INCLUDES) -c -o $@ $<