From c07f762c7a0ab9f597bac44c5b85a6c89977006c Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Tue, 26 Nov 2013 17:25:55 +0100 Subject: [PATCH] Do not use program dependenies on linker command line We have to use only explicitly specified objects based on the content of Makefile.omk. Previously, our automatic dependency generator caused the second compilation to fail because things like /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o appeared on the linker command line. --- snippets/linux.omk | 2 +- tests/programs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/snippets/linux.omk b/snippets/linux.omk index f03c171..f138ac0 100644 --- a/snippets/linux.omk +++ b/snippets/linux.omk @@ -223,7 +223,7 @@ $(2)/$(1)$(3): OMK_CPPFLAGS=$(TARGET_CPPFLAGS) $(2)/$(1)$(3): $(TARGET_OBJS) @$(QUIET_CMD_ECHO) " LINK $$@" $(Q) $(if $(LINK_WITH_CXX),$$(CXX),$$(CC)) \ - $$^ $$($(1)_LIBS:%=-l%) $$(LOADLIBES) $$(OMK_LDFLAGS) $$(LDFLAGS) $$($(1)_LDFLAGS) -Wl,-rpath-link,$(USER_LIB_DIR) -Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map -o $$@ + $(TARGET_OBJS) $$($(1)_LIBS:%=-l%) $$(LOADLIBES) $$(OMK_LDFLAGS) $$(LDFLAGS) $$($(1)_LDFLAGS) -Wl,-rpath-link,$(USER_LIB_DIR) -Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map -o $$@ @echo "$(2)/$(1)$(3): \\" >$(USER_OBJS_DIR)/$(1).exe.d @$(SED4OMK) -n -e 's|^LOAD \(.*\)$$$$| \1 \&|p' $(USER_OBJS_DIR)/$(1).exe.map|tr '&' '\134' >>$(USER_OBJS_DIR)/$(1).exe.d @echo >>$(USER_OBJS_DIR)/$(1).exe.d diff --git a/tests/programs b/tests/programs index 0aee81e..98a626e 100755 --- a/tests/programs +++ b/tests/programs @@ -47,3 +47,16 @@ gen.c: EOF needs_valid_CC WVPASS make + +WVSTART "Compile a single source C program twice" +cat > 'test.c' <<'EOF' +int main() { return 0; } +EOF +cat > 'Makefile.omk' <<'EOF' # OMK manual includes this file - do not modify it +bin_PROGRAMS = test +test_SOURCES = test.c +EOF +needs_valid_CC +WVPASS make +touch test.c +WVPASS make -- 2.39.2