]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Document and fix xxx_GEN_SOURCES
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 12 Nov 2013 23:40:38 +0000 (00:40 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 12 Nov 2013 23:40:38 +0000 (00:40 +0100)
doc/omk-manual.texinfo
snippets/linux.omk
tests/programs

index 475e2da7bfd89d1eba35bdd5a6cefe51313304f5..7f92ff1fe41f9b1325ae78ce9fbb54b726446673 100644 (file)
@@ -359,6 +359,13 @@ source @file{test.c}.
   source.
 @end defvar
 
+@defvar xxx_GEN_SOURCES
+  Program sources generated (by other rules) in the build directory. See
+  the following example.
+  @verbatiminclude tests/programs/generated-sources/Makefile.omk
+
+@end defvar
+
 @defvar xxx_LIBS
   This variable contains a list of libraries the program @var{xxx} will
   be linked with.
index 0935d4cdae877389e03666f8561cef750d55a604..51d5dbfe8693e1a57972a70cb494d224d7e582e6 100644 (file)
@@ -12,6 +12,7 @@
 # test_PROGRAMS    .. list of the testing programs
 # bin_SCRIPTS      .. list of scripts to be copied to _compiled/bin
 # xxx_SOURCES      .. list of specific target sources
+# xxx_GEN_SOURCES  .. list of specific target sources that are generated in the build directory
 # xxx_LIBS         .. list of specific target libraries (-l prefix is automatically added)
 # xxx_LDFLAGS      .. list of specific target LDFLAGS
 # lib_LOADLIBES    .. list of libraries linked to each executable
@@ -220,13 +221,13 @@ $(foreach src,$(filter %.S,$(1)),$(call COMPILE_S_o_template,$(src),$(notdir $(s
 )
 endef
 
-TARGET_GEN_SOURCES =  $(filter %.c,$($(1)_SERVER_IDL:%.idl=%-skels.c)) \
+TARGET_IDL_SOURCES =  $(filter %.c,$($(1)_SERVER_IDL:%.idl=%-skels.c)) \
                       $(filter %.c,$($(1)_SERVER_IDL:%.idl=%-common.c)) \
                       $(filter %.c,$($(1)_CLIENT_IDL:%.idl=%-stubs.c)) \
                       $(filter %.c,$($(1)_CLIENT_IDL:%.idl=%-common.c)) \
                       $(filter %.c,$($(1)_IDL:%.idl=%.c))
-TARGET_SOURCES = $($(1)_SOURCES) $(TARGET_GEN_SOURCES)
-TARGET_SOURCES_ABS = $($(1)_SOURCES:%=$(SOURCES_DIR)/%) $(TARGET_GEN_SOURCES)
+TARGET_SOURCES = $($(1)_SOURCES) $($(1)_GEN_SOURCES) $(TARGET_IDL_SOURCES)
+TARGET_SOURCES_ABS = $($(1)_SOURCES:%=$(SOURCES_DIR)/%) $($(1)_GEN_SOURCES) $(TARGET_IDL_SOURCES)
 TARGET_OBJS  = $(sort $(addsuffix .o,$(basename $(notdir $(TARGET_SOURCES)))))
 TARGET_LOBJS = $(sort $(addsuffix .lo,$(basename $(notdir $(TARGET_SOURCES)))))
 TARGET_IDLS = $($(1)_SERVER_IDL) $($(1)_CLIENT_IDL) $($(1)_IDL)
index ad5e04257c4a56090ac607a3826157a55bd2adea..0aee81e235643d281584900365691c5711d77584 100755 (executable)
@@ -35,3 +35,15 @@ p2_SOURCES = p2.c func.c
 EOF
 needs_valid_CC
 WVPASS make
+
+
+WVSTART "Generated sources"
+cat > 'Makefile.omk' <<'EOF'
+bin_PROGRAMS = p
+p_GEN_SOURCES = gen.c
+
+gen.c:
+       echo "int main() { return 0; }" > $@
+EOF
+needs_valid_CC
+WVPASS make