]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Do not use program dependenies on linker command line
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 26 Nov 2013 16:25:55 +0000 (17:25 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 26 Nov 2013 16:25:55 +0000 (17:25 +0100)
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
tests/programs

index f03c171c0fc4b7a23d5acd7cd43188d1eb494be3..f138ac02c8fe22b05e6d158b1616042d0c670a13 100644 (file)
@@ -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
index 0aee81e235643d281584900365691c5711d77584..98a626ee35879f421aaf5f57c26d360b14a39eb5 100755 (executable)
@@ -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