]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Fix IDL test
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 12 Nov 2013 17:40:49 +0000 (18:40 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 12 Nov 2013 17:40:49 +0000 (18:40 +0100)
This breaks sources_in_subdirectory test, because I changed the way how
object files are generated. Now, every object is generated in the
"current" build directory irrespective to where the source resides.

This might break existing projects. If this happens, we will handle it
somehow.

snippets/linux.omk
tests/idl

index f5cd74436c25e4ab3ef542d48c49ae23f896182c..d69497c6583f039b2fcdeeb970468b093e8ed760 100644 (file)
@@ -131,7 +131,6 @@ ifeq ($$($(2)_C_TARGET),)
 $(2)_C_TARGET=1
 $(2): $(1) $$(GEN_HEADERS)
        @$(QUIET_CMD_ECHO) "  CC      $$@"
-       $(Q)mkdir -p $$(dir $$@)
        $(Q) if $$(c_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
        then mv -f "$$@.d.tmp" "$$@.d" ; \
        else rm -f "$$@.d.tmp" ; exit 1; \
@@ -146,7 +145,6 @@ ifeq ($$($(2)_CC_TARGET),)
 $(2)_CC_TARGET=1
 $(2): $(1) $$(GEN_HEADERS)
        @$(QUIET_CMD_ECHO) "  CXX     $$@"
-       $(Q)mkdir -p $$(dir $$@)
        $(Q) if $$(cc_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
        then mv -f "$$@.d.tmp" "$$@.d" ; \
        else rm -f "$$@.d.tmp" ; exit 1; \
@@ -161,7 +159,6 @@ ifeq ($$($(2)_S_TARGET),)
 $(2)_S_TARGET=1
 $(2): $(1) $$(GEN_HEADERS)
        @$(QUIET_CMD_ECHO) "  AS      $$@"
-       $(Q)mkdir -p $$(dir $$@)
        $(Q) if $$(S_o_COMPILE) -D__ASSEMBLY__ $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
        then mv -f "$$@.d.tmp" "$$@.d" ; \
        else rm -f "$$@.d.tmp" ; exit 1; \
@@ -196,28 +193,30 @@ $(2): $(1)
        $(Q)mv $$@.tmp $$@
 endef
 
-
-
+# Syntax: $(call COMPILE_idl_template,</path/to/src.idl>,<basename>)
 define COMPILE_idl_template
-GEN_HEADERS+=$(filter %.h,$(1:%.idl=%.h))
+ifeq ($$($(2)_IDL_TARGET),)
+$(2)_IDL_TARGET=1
+GEN_HEADERS+=$(filter %.h,$(notdir $(1:%.idl=%.h))) # Do we need this global variable?
 
 $(2).c $(2)-stubs.c $(2)-skels.c $(2)-common.c $(2).h: $(1) $$(wildcard $$(firstword $$(idl_COMPILE)))
        @$(QUIET_CMD_ECHO) "  IDL     $$@"
        $(Q) $$(idl_COMPILE) $$($(2)_IDLFLAGS) $(1)
+endif
 endef
 
-# Syntax: $(call COMPILE_templates,<sources>,<suffix>)
+# Syntax: $(call COMPILE_templates,<sources_abs>,<suffix>)
 # Note: The newlines after $(call ) are IMPORTANT!!!
 define COMPILE_templates
-$(foreach src,$(filter %.c,$(1)),$(call COMPILE_c_o_template,$(SOURCES_DIR)/$(src),$(src:%.c=%$(2)),)
+$(foreach src,$(filter %.c,$(1)),$(call COMPILE_c_o_template,$(src),$(notdir $(src:%.c=%$(2))),)
 )
-$(foreach src,$(filter %.cc,$(1)),$(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cc=%$(2)),)
+$(foreach src,$(filter %.cc,$(1)),$(call COMPILE_cc_o_template,$(src),$(notdir $(src:%.cc=%$(2))),)
 )
-$(foreach src,$(filter %.cxx,$(1)),$(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cxx=%$(2)),)
+$(foreach src,$(filter %.cxx,$(1)),$(call COMPILE_cc_o_template,$(src),$(notdir $(src:%.cxx=%$(2))),)
 )
-$(foreach src,$(filter %.cpp,$(1)),$(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cpp=%$(2)),)
+$(foreach src,$(filter %.cpp,$(1)),$(call COMPILE_cc_o_template,$(src),$(notdir $(src:%.cpp=%$(2))),)
 )
-$(foreach src,$(filter %.S,$(1)),$(call COMPILE_S_o_template,$(SOURCES_DIR)/$(src),$(src:%.S=%$(2)),)
+$(foreach src,$(filter %.S,$(1)),$(call COMPILE_S_o_template,$(src),$(notdir $(src:%.S=%$(2))),)
 )
 endef
 
@@ -227,6 +226,7 @@ TARGET_GEN_SOURCES =  $(filter %.c,$($(1)_SERVER_IDL:%.idl=%-skels.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_OBJS  = $(sort $(addsuffix .o,$(basename $(TARGET_SOURCES))))
 TARGET_LOBJS = $(sort $(addsuffix .lo,$(basename $(TARGET_SOURCES))))
 TARGET_IDLS = $($(1)_SERVER_IDL) $($(1)_CLIENT_IDL) $($(1)_IDL)
@@ -236,7 +236,7 @@ LINK_WITH_CXX = $(filter %.cc,$(TARGET_SOURCES))$(filter %.cxx,$(TARGET_SOURCES)
 define PROGRAM_template
 $(foreach idl,$(TARGET_IDLS),$(call COMPILE_idl_template,$(SOURCES_DIR)/$(idl),$(idl:%.idl=%)))
 
-$(call COMPILE_templates,$(TARGET_SOURCES),.o)
+$(call COMPILE_templates,$(TARGET_SOURCES_ABS),.o)
 
 $(2)/$(1)$(3): $(TARGET_OBJS)
        @$(QUIET_CMD_ECHO) "  LINK    $$@"
@@ -264,7 +264,7 @@ define LIBRARY_template
 
 $(foreach idl,$(TARGET_IDLS),$(call COMPILE_idl_template,$(SOURCES_DIR)/$(idl),$(idl:%.idl=%)))
 
-$(call COMPILE_templates,$(TARGET_SOURCES),.o)
+$(call COMPILE_templates,$(TARGET_SOURCES_ABS),.o)
 
 $(USER_LIB_DIR)/lib$(1).a: $(TARGET_OBJS)
        @$(QUIET_CMD_ECHO) "  AR      $$@"
@@ -279,7 +279,7 @@ define SOLIB_template
 
 $(foreach idl,$(TARGET_IDLS),$(call COMPILE_idl_template,$(SOURCES_DIR)/$(idl),$(idl:%.idl=%)))
 
-$(call COMPILE_templates,$(TARGET_SOURCES),.lo)
+$(call COMPILE_templates,$(TARGET_SOURCES_ABS),.lo)
 
 .PHONY: $(OMK_WORK_DIR)/lib$(1).$(SOLIB_EXT).omkvar
 $(OMK_WORK_DIR)/lib$(1).$(SOLIB_EXT).omkvar: AM_CFLAGS += $(SOLIB_PICFLAGS)
@@ -318,6 +318,7 @@ $(foreach prog,$(bin_PROGRAMS),$(eval $(call PROGRAM_template,$(prog),$(USER_BIN
 $(foreach script,$(bin_SCRIPTS),$(eval $(call SCRIPT_template,$(script),$(USER_BIN_DIR))))
 
 
+$(foreach lib,$(lib_LIBRARIES),$(info $(call LIBRARY_template,$(lib))))
 $(foreach lib,$(lib_LIBRARIES),$(eval $(call LIBRARY_template,$(lib))))
 
 $(foreach lib,$(shared_LIBRARIES),$(eval $(call SOLIB_template,$(lib))))
index 6db9557692443dd2d0ed13ea25e09a7921aac372..17e082c95bedf3598dda3a953543249cd0234425 100755 (executable)
--- a/tests/idl
+++ b/tests/idl
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-. ./functions.sh
+. ./wvtest.sh
 
 case $OMK_RULES in
     sysless) echo "SKIPPING sysless RULES!!!!"; exit;