]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/commitdiff
rtems: Build system learned how to compile IDL files
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 11 Mar 2011 15:36:08 +0000 (16:36 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 11 Mar 2011 15:36:08 +0000 (16:36 +0100)
build/rtems/Makefile.rules
build/rtems/config.target
src/forb/forb-idl/Makefile.omk

index 49a47db57aa8b932f1a85f7cb94c94a9455c23ff..6ea26c787b3e3c32d45a1cb5760eaa1ec788251a 100644 (file)
@@ -4,7 +4,7 @@
 #  (C) Copyright 2006, 2007, 2008, 2009, 2010, 2011 by Michal Sojka - Czech Technical University, FEE, DCE
 #
 #  Homepage: http://rtime.felk.cvut.cz/omk/
-#  Version:  0.2-69-g6789c3e
+#  Version:  0.2-71-g101fc03
 #
 # The OMK build system is distributed under the GNU General Public
 # License.  See file COPYING for details.
@@ -524,8 +524,24 @@ $(2): $(1)
                | sort >>$$@
 endef
 
+idl_COMPILE = $(IDL_COMPILER)
+
+define COMPILE_idl_template
+$(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)
+endef
+
 # Syntax: $(call PROGRAM_template,<dir>,<executable-name>,<link-variant>)
 define PROGRAM_template
+USER_IDLS  += $$($(1)_SERVER_IDL) $$($(1)_CLIENT_IDL) $$($(1)_IDL)
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-skels.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-common.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-stubs.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-common.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_IDL:%.idl=%.c))
+USER_GEN_SOURCES += $$($(1)_GEN_SOURCES)
+
 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.c=%.o))
 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cc=%.o))
 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cxx=%.o))
@@ -557,6 +573,14 @@ endef
 
 # Syntax: $(call LIBRARY_template,<library-name>)
 define LIBRARY_template
+USER_IDLS  += $$($(1)_SERVER_IDL) $$($(1)_CLIENT_IDL) $$($(1)_IDL)
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-skels.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-common.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-stubs.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-common.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_IDL:%.idl=%.c))
+USER_GEN_SOURCES += $$($(1)_GEN_SOURCES)
+
 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.c=%.o))
 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cc=%.o))
 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cxx=%.o))
@@ -578,6 +602,14 @@ endef
 
 # Syntax: $(call SOLIB_template,<library-name>)
 define SOLIB_template
+USER_IDLS  += $$($(1)_SERVER_IDL) $$($(1)_CLIENT_IDL) $$($(1)_IDL)
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-skels.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-common.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-stubs.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-common.c))
+$(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_IDL:%.idl=%.c))
+SOLIB_GEN_SOURCES += $$($(1)_GEN_SOURCES)
+
 $(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.c=%.lo))
 $(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.cc=%.lo))
 $(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.cxx=%.lo))
@@ -611,6 +643,7 @@ $(foreach cmetrh,$(cmetric_include_HEADERS),$(eval $(call CMETRIC_o_h_template,\
                $(addprefix $(USER_INCLUDE_DIR)/,$(cmetrh)))))
 
 GEN_HEADERS+=$(cmetric_include_HEADERS:%=$(USER_INCLUDE_DIR)/%)
+GEN_HEADERS+=$(filter %.h,$(USER_IDLS:%.idl=%.h))
 
 # Generate rules for compilation of programs and libraries
 
@@ -624,6 +657,11 @@ $(foreach lib,$(lib_LIBRARIES),$(eval $(call LIBRARY_template,$(lib))))
 
 $(foreach lib,$(shared_LIBRARIES),$(eval $(call SOLIB_template,$(lib))))
 
+# IDL compilation
+USER_IDLS := $(sort $(USER_IDLS))
+$(foreach src,$(filter %.idl,$(USER_IDLS)),$(eval $(call COMPILE_idl_template,$(SOURCES_DIR)/$(src),$(src:%.idl=%))))
+
+
 -include $(USER_OBJS_DIR)/*.d
 
 endif
@@ -631,7 +669,7 @@ endif
 #=====================================================================
 
 
-$(eval $(call omk_pass_template, include-pass,$(USER_OBJS_DIR),,$(include_HEADERS)$(nobase_include_HEADERS)$(renamed_include_HEADERS)$(config_include_HEADERS)$(LOCAL_CONFIG_H)))
+$(eval $(call omk_pass_template, include-pass,$(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(include_HEADERS)$(nobase_include_HEADERS)$(renamed_include_HEADERS)$(config_include_HEADERS)$(LOCAL_CONFIG_H)))
 $(eval $(call omk_pass_template, library-pass,$(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(lib_LIBRARIES)$(shared_LIBRARIES)))
 $(eval $(call omk_pass_template, binary-pass, $(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(bin_PROGRAMS)$(utils_PROGRAMS)$(test_PROGRAMS)))
 
@@ -651,6 +689,7 @@ ifdef USER_RULE_TEMPLATES
 # User-space static libraries and applications object files
 
 USER_SOURCES := $(sort $(USER_SOURCES))
+USER_GEN_SOURCES := $(sort $(USER_GEN_SOURCES))
 
 #$(warning USER_SOURCES = $(USER_SOURCES))
 
@@ -662,6 +701,8 @@ $(foreach src,$(filter %.cxx,$(USER_SOURCES)),$(eval $(call COMPILE_cc_o_templat
 
 $(foreach src,$(filter %.S,$(USER_SOURCES)),$(eval $(call COMPILE_S_o_template,$(SOURCES_DIR)/$(src),$(src:%.S=%.o),)))
 
+$(foreach src,$(filter %.c,$(USER_GEN_SOURCES)),$(eval $(call COMPILE_c_o_template,$(src),$(src:%.c=%.o),)))
+
 # User-space shared libraries object files
 
 SOLIB_SOURCES := $(sort $(SOLIB_SOURCES))
@@ -691,6 +732,13 @@ clean-local:
 
 
 default: include-pass library-pass binary-pass
+
+include-pass-submakes: extra-rules-subdirs
+
+# We must go to EXTRA_RULES_SUBDIRS before going to any other
+# directory, since the executables compiled in EXTRA_RULES_SUBDIRS
+# might be needed there.
+include-pass-this-dir $(foreach subdir,$(SUBDIRS),include-pass-$(subdir)-subdir): extra-rules-subdirs
                                                                                  #OMK:config_h.omk@Makefile.rules.rtems
 # Syntax: $(call BUILD_CONFIG_H_template,<stamp_dir>,<header_file_path>,<list_of_options_to_export>,<header_barrier>)
 define BUILD_CONFIG_H_template
index ac2d70d6c403b9f72edc01d850e1471716ba4970..8845b0cf7ce1ad15574756d8f170236afca99b0c 100644 (file)
@@ -9,9 +9,9 @@ test: wvtest
 .PHONY: test
 
 # Platform name as preprocessor symbol
-export PLATFORM=AQuoSA
+export PLATFORM=rtems
 # Platform name as used in file names
-export PLATFORM_FN=linux
+export PLATFORM_FN=rtems
 
 # Create symbolic links to headers instead of copying them. Useful
 # during development.
@@ -32,7 +32,7 @@ CFLAGS=$(ARCH_GCC_OPTS) -fpic -Wall -Wuninitialized -g -O1 -D_REENTRANT -D$(PLAT
 LDFLAGS=$(ARCH_LD_OPTS) $(LIBS_PATH) $(LIBS)
 LDFLAGS += '-Wl,-rpath,$$ORIGIN/../lib' -z origin --enable-new-dtags
 
-IDL_COMPILER = $(OUTPUT_DIR)/$(COMPILED_DIR_NAME)/bin/forb-idl
+IDL_COMPILER = $(OUTPUT_DIR)/_compiled/bin/forb-idl
 
 # Other config
 FRSH_DISTRIBUTED_MODULE_SUPPORTED=true
index 657ae3392e03ca7cbbea20f734bbd5791a283d33..bb80d471e7ea6ade710d104c20b969a580d11757 100644 (file)
@@ -1,3 +1,4 @@
+CC=gcc # Hack to overcome OMK limitation - we'd need host_PROGRAMS for this
 bin_PROGRAMS = forb-idl
 
 #GLIB_FLAGS := $(shell pkg-config --cflags glib-2.0)