]> rtime.felk.cvut.cz Git - omk.git/blobdiff - snippets/linux
Changes to vxWorks support. Still not fully functional.
[omk.git] / snippets / linux
index e8698ffbf11e346ff1a3f40dfe22192a11bafbe5..107c534213f1f6319213f53c7917418b220fecb8 100644 (file)
@@ -1,3 +1,6 @@
+#                   Version for Linux/RTLinux builds.
+#
+#
 # input variables
 # lib_LIBRARIES    .. list of the user-space libraries
 # shared_LIBRARIES .. list of the user-space shared libraries
@@ -16,8 +19,7 @@
 # INCLUDES         .. additional include directories and defines for user-space
 # kernel_INCLUDES  .. additional include directories and defines for kernel-space
 # rtlinux_INCLUDES .. additional include directories and defines for RT-Linux
-# QT_SUBDIRS       .. subdirectories where to build QT applications using qmake
-# QTDIR                   .. where QT resides
+# OMIT_KERNEL_PASSES  if defined, all kernel passes are omited
 #
 # LINUX_DIR        .. location of Linux kernel sources
 # RTL_DIR          .. location of RT-Linux sources
 #CONFIG_RTLINUX = y
 #OCERA_DIR := $(shell ( cd -L $(MAKERULES_DIR)/../../.. ; pwd -L ) )
 
-# # Check and include real OCERA style Makefile.omk now
-# ifndef OMK_INCLUDED
-# include $(SOURCES_DIR)/Makefile.omk
-# OMK_INCLUDED := 1
-# endif
-# FIXME: Maybe the order of this is important. Is it wrong when this is located in base?
-
 #CFLAGS += -ggdb
 CFLAGS += -O2 
 CFLAGS += -Wall
@@ -91,7 +86,7 @@ KERN_OBJS_DIR = $(KERN_BUILD_DIR)/$(RELATIVE_DIR)
 ifneq ($(OMK_SERIALIZE_INCLUDED),y)
 include-pass: $(check-dir)
 library-pass: include-pass
-binary-pass utils-pass: library-pass
+binary-pass: library-pass
 kernel-lib-pass: include-pass
 kernel-mod-pass: kernel-lib-pass
 kernel-modpost-pass: kernel-mod-pass
@@ -193,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)
@@ -278,9 +274,7 @@ endef
 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-pass-local: $(utils_PROGRAMS:%=$(USER_UTILS_DIR)/%)
+binary-pass-local: $(bin_PROGRAMS:%=$(USER_BIN_DIR)/%) $(utils_PROGRAMS:%=$(USER_UTILS_DIR)/%)
 
 # Special rules for CMETRIC generated headers
 
@@ -555,8 +549,8 @@ endif
 
 #=====================================================================
 
-$(eval $(call omk_pass_template, kernel-lib-pass,$(KERN_OBJS_DIR),KERN_RULE_TEMPLATES=y,-n "$(kernel_LIBRARIES)$(rtlinux_LIBRARIES)"))
-$(eval $(call omk_pass_template, kernel-mod-pass,$(KERN_OBJS_DIR),KERN_RULE_TEMPLATES=y,-n "$(kernel_MODULES)$(rtlinux_MODULES)"))
+$(eval $(call omk_pass_template, kernel-lib-pass,$(KERN_OBJS_DIR),KERN_RULE_TEMPLATES=y,$(kernel_LIBRARIES)$(rtlinux_LIBRARIES)))
+$(eval $(call omk_pass_template, kernel-mod-pass,$(KERN_OBJS_DIR),KERN_RULE_TEMPLATES=y,$(kernel_MODULES)$(rtlinux_MODULES)))
 
 kernel-modpost-pass:
        +@if [ -e "$(KERN_MODPOST_DIR)/module-changes" -o -e "$(KERN_MODPOST_DIR)/modpost-running" ] ; \
@@ -565,27 +559,11 @@ kernel-modpost-pass:
               -f $(SOURCES_DIR)/Makefile KERN_RULE_TEMPLATES=y KERN_MODPOST_PASS=y $(@:%=%-local) ; \
        fi
 
-define qt_subpass
-       +@$(foreach dir, $(QT_SUBDIRS), $(call mkdir_def,$(USER_OBJS_DIR)/$(dir)) ; \
-               if [ "$@" != "binary-pass" ] ; then exit 0 ; fi ; \
-               if [ ! -e $(SOURCES_DIR)/$(dir)/Makefile ] ; then  \
-               ( cd $(SOURCES_DIR)/$(dir) ; $$QTDIR/bin/qmake TOP_DIR=$(MAKERULES_DIR) \
-                    RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir) QTDIR=$(QTDIR) CC=$(CC) \
-                    CXX=$(CXX) || exit 1 ;) ; fi ; \
-               $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) \
-               RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir) -C $(SOURCES_DIR)/$(dir) \
-               -f $(SOURCES_DIR)/$(dir)/Makefile || exit 1 ;)
-endef
-
-$(eval $(call omk_pass_template, library-pass,$(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,-n "$(lib_LIBRARIES)$(shared_LIBRARIES)"))
-$(eval $(call omk_pass_template, utils-pass,  $(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,-n "$(utils_PROGRAMS)"))
-$(eval $(call omk_pass_template, binary-pass, $(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,-n "$(bin_PROGRAMS)$(QT_SUBDIRS)",$(qt_subpass)))
-
-OTHER_PASSES = dep clean install include-pass
-$(eval $(call omk_pass_template,$(OTHER_PASSES), $(USER_OBJS_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)))
 
-# FIXME: Are the 'dep' and 'install' passes usefull?
-dep-local:
+OTHER_PASSES = clean install include-pass
+$(eval $(call omk_pass_template,$(OTHER_PASSES),$(USER_OBJS_DIR),,always))
 
 # Create directories only for the first time
 ifndef CHECK_DIR_DONE
@@ -595,7 +573,6 @@ endif
 export CHECK_DIR_DONE
 
 check-dir:
-       echo aaaaaaaaaaaaaa
        @$(call mkdir_def,$(USER_BUILD_DIR))
        @$(call mkdir_def,$(KERN_BUILD_DIR))
        @$(call mkdir_def,$(USER_INCLUDE_DIR))
@@ -607,28 +584,11 @@ check-dir:
        @$(call mkdir_def,$(KERN_MODULES_DIR))
        @$(call mkdir_def,$(KERN_MODPOST_DIR))
 
-install-local:
+install-local:                 # TODO
 
 include-pass-local:
-       @$(call mkdir_def,$(USER_INCLUDE_DIR))
-       @$(foreach f, $(include_HEADERS), cmp --quiet $(SOURCES_DIR)/$(f) $(USER_INCLUDE_DIR)/$(notdir $(f)) \
-          || cp $(CPHEADER_FLAGS) $(SOURCES_DIR)/$(f) $(USER_INCLUDE_DIR)/$(notdir $(f)) || exit 1 ; )
-       @$(foreach f, $(nobase_include_HEADERS), cmp --quiet $(SOURCES_DIR)/$(f) $(USER_INCLUDE_DIR)/$(f) \
-          || ( mkdir -p $(USER_INCLUDE_DIR)/$(dir $(f)) && cp $(CPHEADER_FLAGS) $(SOURCES_DIR)/$(f) $(USER_INCLUDE_DIR)/$(f) ) || exit 1 ; )
-       @$(foreach f, $(renamed_include_HEADERS), \
-          srcfname=`echo '$(f)' | sed -e 's/^\(.*\)->.*$$/\1/'` ; destfname=`echo '$(f)' | sed -e 's/^.*->\(.*\)$$/\1/'` ; \
-          cmp --quiet $(SOURCES_DIR)/$${srcfname} $(USER_INCLUDE_DIR)/$${destfname} \
-          || ( mkdir -p `dirname $(USER_INCLUDE_DIR)/$${destfname}` && cp $(CPHEADER_FLAGS) $(SOURCES_DIR)/$${srcfname} $(USER_INCLUDE_DIR)/$${destfname} ) || exit 1 ; )
-# Kernel and RT-Linux stuff
-       @$(call mkdir_def,$(KERN_INCLUDE_DIR))
-       @$(foreach f, $(kernel_HEADERS) $(rtlinux_HEADERS), cmp --quiet $(SOURCES_DIR)/$(f) $(KERN_INCLUDE_DIR)/$(notdir $(f)) \
-          || cp $(CPHEADER_FLAGS) $(SOURCES_DIR)/$(f) $(KERN_INCLUDE_DIR)/$(notdir $(f)) || exit 1 ; )
-       @$(foreach f, $(nobase_kernel_HEADERS) $(nobase_rtlinux_HEADERS), cmp --quiet $(SOURCES_DIR)/$(f) $(KERN_INCLUDE_DIR)/$(f) \
-          || ( mkdir -p $(KERN_INCLUDE_DIR)/$(dir $(f)) && cp $(CPHEADER_FLAGS) $(SOURCES_DIR)/$(f) $(KERN_INCLUDE_DIR)/$(f) ) || exit 1 ; )
-       @$(foreach f, $(renamed_kernel_HEADERS) $(renamed_rtlinux_HEADERS), \
-          srcfname=`echo '$(f)' | sed -e 's/^\(.*\)->.*$$/\1/'` ; destfname=`echo '$(f)' | sed -e 's/^.*->\(.*\)$$/\1/'` ; \
-          cmp --quiet $(SOURCES_DIR)/$${srcfname} $(KERN_INCLUDE_DIR)/$${destfname} \
-          || ( mkdir -p `dirname $(KERN_INCLUDE_DIR)/$${destfname}` && cp $(CPHEADER_FLAGS) $(SOURCES_DIR)/$${srcfname} $(KERN_INCLUDE_DIR)/$${destfname} ) || exit 1 ; )
+       $(call include-pass-template,$(USER_INCLUDE_DIR),include)
+       $(call include-pass-template,$(KERN_INCLUDE_DIR),kernel)
 
 ifdef USER_RULE_TEMPLATES
 
@@ -687,13 +647,6 @@ $(foreach src,$(filter %.cxx,$(KERN_SOURCES)),$(eval $(call COMPILE_cc_o_kern_te
 
 endif
 
-# Special rules for configuration exported headers
-
-$(foreach confh,$(config_include_HEADERS),$(eval $(call BUILD_CONFIG_H_template,$(addprefix $(USER_INCLUDE_DIR)/,$(confh)),$(basename $(notdir $(confh)))_DEFINES,\
-_$(basename $(notdir $(confh)))_H \
-)))
-
-
 clean-local: clean-custom
        @echo Cleaning in $(KERN_OBJS_DIR) and $(USER_OBJS_DIR)
        @rm -f $(KERN_OBJS_DIR)/*.o $(USER_OBJS_DIR)/*.o $(USER_OBJS_DIR)/*.lo \
@@ -706,11 +659,12 @@ clean-local: clean-custom
        @if [ -e $(KERN_LIB_DIR)/kernel.mk ] ; then \
            touch -t 200001010101 $(KERN_LIB_DIR)/kernel.mk ; \
        fi
-       @$(foreach confh,$(addprefix $(USER_INCLUDE_DIR)/,$(config_include_HEADERS)),\
-           if [ -e $(confh) ] ; then touch -t 200001010101 $(confh) ; fi ; \
-       )
 
-default: $(check-dir) include-pass library-pass binary-pass utils-pass kernel-lib-pass kernel-pass
+default: $(check-dir) include-pass library-pass binary-pass
+ifndef OMIT_KERNEL_PASSES
+# Also make kernel passes if not disabled
+default: kernel-lib-pass kernel-pass
+endif
 
 # Local Variables:
 # mode:makefile