]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Changes to vxWorks support. Still not fully functional.
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 18 Oct 2006 15:39:00 +0000 (15:39 +0000)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 18 Oct 2006 15:39:00 +0000 (15:39 +0000)
darcs-hash:20061018153946-f2ef6-170b5b28790fa83631fe893ff5793c2cf33d03f7.gz

snippets/base
snippets/linux
snippets/vxworks
snippets/vxworks-setup
tests/vxworks/config.target [new file with mode: 0644]

index a62f18a44d49b980e3a7be81caa984036042ef23..6eb82878d8dba713c7c86ed18f8f439cf8697452 100644 (file)
@@ -114,18 +114,22 @@ define mkdir_def
        [ -d $(1) ] || mkdir -p $(1) || exit 1
 endef
 
+ifneq ($(V),2)
+NO_PRINT_DIRECTORY := --no-print-directory
+endif
+
 # Syntax: $(call omk_pass_template,<pass name>,<build dir>,[<local make flags>],[<local condition>])
 define omk_pass_template
 .PHNOY: $(1) $(1)-local
 $(1):
-       +@$(foreach dir,$(SUBDIRS),$(call mkdir_def,$(2)/$(dir)) ; \
-               $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) --no-print-directory \
+       +@$(foreach dir,$(SUBDIRS),$(call mkdir_def,$(2)/$(dir)); \
+               $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) $(NO_PRINT_DIRECTORY) \
                RELATIVE_DIR=$(RELATIVE_DIR)/$(dir) -C $(2)/$(dir) \
                -f $(SOURCES_DIR)/$(dir)/Makefile $$@ || exit 1 ;)
 ifneq ($(4),)
        @echo "make[omk]:$$@ in $(RELATIVE_DIR)"; \
        $(call mkdir_def,$(2)); \
-       $(MAKE) --no-print-directory -C $(2) \
+       $(MAKE) $(NO_PRINT_DIRECTORY) -C $(2) \
                -f $(SOURCES_DIR)/Makefile $(3) $$(@:%=%-local)
 endif
 endef
@@ -138,7 +142,7 @@ default-config:
        @echo "# This file should not be altered manually" >> "$(CONFIG_FILE)-default"
        @echo "# Overrides should be stored in file $(notdir $(CONFIG_FILE))" >> "$(CONFIG_FILE)-default"
        @echo >> "$(CONFIG_FILE)-default"
-       @$(MAKE) --no-print-directory -C $(MAKERULES_DIR) \
+       @$(MAKE) $(NO_PRINT_DIRECTORY) -C $(MAKERULES_DIR) \
                RELATIVE_DIR="" SOURCES_DIR=$(MAKERULES_DIR) \
                -f $(MAKERULES_DIR)/Makefile default-config-pass
 
index c38688698817480a34c85fb881ea1333e657935d..107c534213f1f6319213f53c7917418b220fecb8 100644 (file)
@@ -188,6 +188,7 @@ endef
 
 
 # Syntax: $(call PROGRAM_template,<dir>,<executable-name>,<executable-suffix>,<linker-sript>)
+# FIXME: ???????? asi je tu blbej komentar
 define PROGRAM_template
 
 USER_IDLS  += $$($(1)_SERVER_IDL) $$($(1)_CLIENT_IDL) $$($(1)_IDL)
index ce46a31c50ee4ea7043f2bb63a166b72607ab13c..f0431cd2c3e9d254b2721fc3f9e12f475cb95b67 100644 (file)
@@ -1,4 +1,132 @@
 
+#TODO: Asi je potreba pouzit wrenv.sh utilitku!!!
+
+
+# Some support to serialize some targets for parallel make
+ifneq ($(OMK_SERIALIZE_INCLUDED),y)
+include-pass: $(check-dir)
+library-pass: include-pass
+binary-pass: library-pass
+kernel-lib-pass: include-pass
+kernel-mod-pass: kernel-lib-pass
+kernel-modpost-pass: kernel-mod-pass
+kernel-pass: kernel-mod-pass kernel-modpost-pass
+
+OMK_SERIALIZE_INCLUDED = y
+endif
+
+
+BUILD_ROOT=$(USER_OBJS_DIR)
+WIND_HOST_TYPE := $(shell $(WIND_BASE)/host/resource/wind_host_type)
+export BUILD_ROOT WIND_HOST_TYPE
+#OBJ_DIR - mozna taky nejak nastavit
+
+USER_SOURCES2OBJS = .o/.c .o/.cc .o/.cxx .o/.o
+
+# Syntax: $(call PROGRAM_template,<executable-name>,<dir>,<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)
+
+$(foreach x, $(USER_SOURCES2OBJS),
+$(1)_OBJS += $$(patsubst %$(notdir $(x)),%$(dir $(x)),$$(filter %$(notdir $(x)),\
+               $$($(1)_SOURCES) $$($(1)_GEN_SOURCES)))
+)
+$(1)_OBJS := $$(sort $$($(1)_OBJS:%/=%))
+
+USER_OBJS  += $$($(1)_OBJS)
+USER_SOURCES += $$($(1)_SOURCES)
+
+$(2)/$(1): $$($(1)_OBJS)
+       @$(QUIET_CMD_ECHO) "  LINK    $$@"
+       @echo "EXE = $(1).vxe" > Makefile.vxe.$(1); \
+       echo "OBJS = $(1)_OBJS" >> Makefile.vxe.$(1); \
+       echo "VXE_DIR = $(2)" >> Makefile.vxe.$(1); \
+       echo "include $(WIND_BASE)/target/usr/make/rules.rtp" >> Makefile.vxe.$(1); \
+       $(MAKE)  CPU=$(CPU) TOOL=$(TOOL) -f Makefile.vxe.$(1)
+#      $(Q) $$(shell if [ -z "$$(filter %.cc,$$($(1)_SOURCES:%.cxx=%.cc))" ] ; then echo $$(CC) ; else echo $$(CXX) ; fi) \
+#        $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) $$(LOADLIBES) $$(LDFLAGS) -Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map -o $(2)/$(1)
+#      @echo "$(2)/$(1): \\" >$(USER_OBJS_DIR)/$(1).exe.d
+#      @sed -n -e 's/^LOAD \(.*\)$$$$/  \1  \\/p' $(USER_OBJS_DIR)/$(1).exe.map  >>$(USER_OBJS_DIR)/$(1).exe.d
+#      @echo >>$(USER_OBJS_DIR)/$(1).exe.d
+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)
+
+$(foreach x, $(USER_SOURCES2OBJS),
+$(1)_OBJS += $$(patsubst %$(notdir $(x)),%$(dir $(x)),$$(filter %$(notdir $(x)),\
+               $$($(1)_SOURCES) $$($(1)_GEN_SOURCES)))
+)
+$(1)_OBJS := $$(sort $$($(1)_OBJS:%/=%))
+USER_OBJS  += $$($(1)_OBJS)
+USER_SOURCES += $$($(1)_SOURCES)
+
+$(USER_LIB_DIR)/lib$(1).a: #$$($(1)_OBJS)
+       @$(QUIET_CMD_ECHO) "  LIB     $$@"
+       @echo "LIB_BASE_NAME = $(1)" > Makefile.lib.$(1); \
+       echo "OBJS = $$($(1)_OBJS)" >> Makefile.lib.$(1); \
+       echo "LIB_ROOT = $(USER_LIB_DIR)" >> Makefile.lib.$(1); \
+       echo "VPATH = $(SOURCES_DIR)" >> Makefile.lib.$(1); \
+       echo "include $(WIND_BASE)/target/usr/make/rules.library" >> Makefile.lib.$(1); \
+       $(MAKE) CPU=$(CPU) TOOL=$(TOOL) -f Makefile.lib.$(1)
+endef
+
+
+
+
+# Generate rules for compilation of programs and libraries
+
+$(foreach prog,$(utils_PROGRAMS),$(eval $(call PROGRAM_template,$(prog),$(USER_UTILS_DIR))))
+
+$(foreach prog,$(bin_PROGRAMS),$(eval $(call PROGRAM_template,$(prog),$(USER_BIN_DIR))))
+
+$(foreach lib,$(lib_LIBRARIES),$(eval $(call LIBRARY_template,$(lib))))
+
+$(foreach lib,$(shared_LIBRARIES),$(eval $(call SOLIB_template,$(lib))))
+
+-include $(USER_OBJS_DIR)/*.d
+
+library-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(cmetric_include_HEADERS)) \
+                   $(lib_LIBRARIES:%=$(USER_LIB_DIR)/lib%.a) $(shared_LIBRARIES:%=$(USER_LIB_DIR)/lib%.$(SOLIB_EXT))
+
+binary-pass-local: $(bin_PROGRAMS:%=$(USER_BIN_DIR)/%) $(utils_PROGRAMS:%=$(USER_UTILS_DIR)/%)
+
+$(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)))
+
+
+# Create directories only for the first time
+ifndef CHECK_DIR_DONE
+check-dir = check-dir
+CHECK_DIR_DONE = y
+endif
+export CHECK_DIR_DONE
+
+check-dir:
+       @$(call mkdir_def,$(USER_BUILD_DIR))
+       @$(call mkdir_def,$(USER_INCLUDE_DIR))
+       @$(call mkdir_def,$(USER_LIB_DIR))
+       @$(call mkdir_def,$(USER_BIN_DIR))
+       @$(call mkdir_def,$(USER_UTILS_DIR))
+
+
+default: $(check-dir) include-pass library-pass binary-pass
 
 # Local Variables:
 # mode:makefile
index 5a38307e0887dd39380ad7a9f6b390635e503c8d..65a83fa659521efa99db5dfa3cc40c3456bbb6ae 100644 (file)
@@ -1,17 +1,23 @@
 
-# Include VxWorks target configuration
-# TODO: Specify what should be defined
-# WIND_USR? or maybe WIND_BASE is better
+# Include VxWorks target configuration containig definition of these
+# variables: WIND_BASE CPU TOOL
 include $(MAKERULES_DIR)/config.target
+ifndef WIND_BASE
+$(error WIND_BASE not defined in config.target)
+endif
+ifndef CPU
+$(error CPU not defined in config.target)
+endif
+ifndef TOOL
+$(error TOOL not defined in config.target)
+endif
+WIND_USR ?= $(WIND_BASE)/target/usr
+export WIND_USR WIND_BASE CPU TOOL
 
 # TODO: Set OBJ_DIR for VxWorks Makefile
 
-include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
-include $(RTEMS_CUSTOM)
-include $(CONFIG.CC)
-
-BUILD_DIR_NAME = _build/$(RTEMS_BSP)
-COMPILED_DIR_NAME = _compiled/$(RTEMS_BSP)
+BUILD_DIR_NAME = _build/$(CPU)$(TOOL)
+COMPILED_DIR_NAME = _compiled/$(CPU)$(TOOL)
 GROUP_DIR_NAME =
 
 
@@ -19,8 +25,11 @@ USER_INCLUDE_DIR := $(MAKERULES_DIR)/$(COMPILED_DIR_NAME)/include
 USER_LIB_DIR     := $(MAKERULES_DIR)/$(COMPILED_DIR_NAME)/lib
 USER_UTILS_DIR   := $(MAKERULES_DIR)/$(COMPILED_DIR_NAME)/bin-utils
 USER_BIN_DIR     := $(MAKERULES_DIR)/$(COMPILED_DIR_NAME)/bin
-USER_BUILD_DIR   := $(MAKERULES_DIR)/$(BUILD_DIR_NAME)/user
+USER_BUILD_DIR   := $(MAKERULES_DIR)/$(BUILD_DIR_NAME)/rtp
 
+# Note the use of "recursive" =. That's because RELATIVE_DIR is
+# sometimes defined later in 'base'.
+USER_OBJS_DIR    = $(USER_BUILD_DIR)/$(RELATIVE_DIR)
 LOCAL_BUILD_DIR  = $(USER_OBJS_DIR)
 
 # Local Variables:
diff --git a/tests/vxworks/config.target b/tests/vxworks/config.target
new file mode 100644 (file)
index 0000000..8892df9
--- /dev/null
@@ -0,0 +1,3 @@
+CPU=SIMPENTIUM
+TOOL=diab
+WIND_BASE=~/opt/WindRiver/vxworks-6.1