# W .. whole tree - if set to 1, make is always called from the top-level directory
# SUBDIRS .. list of subdirectories intended for make from actual directory
# default_CONFIG .. list of default config assignments CONFIG_XXX=y/n ...
-# LOCAL_CONFIG_H .. name of local config.h file generated from values #OMK@config_h
-# of options defined in the current directory
-# config_include_HEADERS .. names of global config files (possibly
-# with subdirectories)
-# xxx_DEFINES .. list of config directives to be included in
-# config header file of the name <somedir>/xxx.h
# LN_HEADERS .. if "y", header files are symbolicaly linked instead of copied. #OMK@include
# #OMK@linux
# input variables
#
# LINUX_DIR .. location of Linux kernel sources
# RTL_DIR .. location of RT-Linux sources
+# CFLAGS .. C compiler flags
+# CXXFLAGS .. C++ compiler flags
+# LOCAL_CONFIG_H .. name of local config.h file generated from values #OMK@config_h
+# of options defined in the current directory
+# config_include_HEADERS .. names of global config files (possibly
+# with subdirectories)
+# xxx_DEFINES .. list of config directives to be included in
+# config header file of the name <somedir>/xxx.h
# QT_SUBDIRS .. subdirectories where to build QT applications using qmake #OMK@qt
# QTDIR .. where QT resides
-include $(MAKERULES_DIR)/OCERA_TOP_DIR #OMK@linux-setup
@$(foreach x, $(default_CONFIG), echo $(x) | \
sed -e 's/^.*=x$$/#\0/' >> "$(CONFIG_FILE)-default" ; )
- #OMK@config_h
-# Syntax: $(call BUILD_CONFIG_H_template,<header_file_path>,<list_of_options_to_export>,<header_barrier>)
-define BUILD_CONFIG_H_template
-
-$(1) : $(wildcard $(CONFIG_FILE)) $(wildcard $(CONFIG_FILE)-default)
- @$(QUIET_CMD_ECHO) " CONFGEN $$(@:$(MAKERULES_DIR)/%=%)"
- @if [ ! -d `dirname $(1).tmp` ] ; then \
- mkdir `dirname $(1).tmp` ; fi
- @echo "/* Automatically generated from */" > "$(1).tmp"
- @echo "/* config file: $$< */" >> "$(1).tmp"
- @echo "#ifndef $(3)" >> "$(1).tmp"
- @echo "#define $(3)" >> "$(1).tmp"
- @( $(foreach x, $(shell echo '$($(2))' | sed -e 's/\<\([^ =]*\)\(=[^ ]\+\|\)\>/\1/g' ), \
- echo '$(x).$($(x))' ; ) echo ; ) | \
- sed -e '/^[^.]*\.n$$$$/d' -e '/^[^.]*\.$$$$/d' -e 's/^\([^.]*\)\.[ym]$$$$/\1.1/' | \
- sed -n -e 's/^\([^.]*\)\.\(.*\)$$$$/#define \1 \2/p' \
- >> "$(1).tmp"
- @echo "#endif /*$(3)*/" >> "$(1).tmp"
- @if cmp --quiet "$(1).tmp" "$(1)" ; then rm "$(1).tmp" ; \
- else mv "$(1).tmp" "$(1)" ; \
- echo Updated configuration "$(1)" ; fi
-
-endef
-
-ifdef LOCAL_CONFIG_H
-
-CFLAGS += -I.
-$(eval $(call BUILD_CONFIG_H_template,$(LOCAL_CONFIG_H),default_CONFIG,_LOCAL_CONFIG_H) )
-
-endif
-
-# Special rules for configuration exported headers
-
-#FIXME: The directory for headers should not be specified here.
-$(foreach confh,$(config_include_HEADERS),$(eval $(call BUILD_CONFIG_H_template,$(addprefix $(USER_INCLUDE_DIR)/,$(confh)),$(basename $(notdir $(confh)))_DEFINES,\
-_$(basename $(notdir $(confh)))_H \
-)))
-
-# Add some hooks to standard passes
-include-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(config_include_HEADERS))
-
-clean-local: clean-local-config-h
-
-clean-local-config-h:
- @$(foreach confh,$(addprefix $(USER_INCLUDE_DIR)/,$(config_include_HEADERS)),\
- if [ -e $(confh) ] ; then touch -t 200001010101 $(confh) ; fi ; \
- )
-
-
-# Local Variables:
-# mode:makefile
-# End:
ifeq ($(OMK_VERBOSE),1) #OMK@include
CPHEADER_FLAGS += -v
LNHEADER_FLAGS += -v
#CONFIG_RTLINUX = y
#OCERA_DIR := $(shell ( cd -L $(MAKERULES_DIR)/../../.. ; pwd -L ) )
-#CFLAGS += -ggdb
-CFLAGS += -O2
-CFLAGS += -Wall
-#CXXFLAGS += -ggdb
-CXXFLAGS += -O0
-CXXFLAGS += -Wall
+# Assign default values to CFLAGS variable. If the variable is defined
+# earlier (i.g. in config.omk), it is not overriden here.
+CFLAGS ?= -O2 -Wall
+CXXFLAGS ?= -O2 -Wall
CPPFLAGS += -I $(USER_INCLUDE_DIR)
default: kernel-lib-pass kernel-pass
endif
+# Local Variables:
+# mode:makefile
+# End:
+ #OMK@config_h
+# Syntax: $(call BUILD_CONFIG_H_template,<header_file_path>,<list_of_options_to_export>,<header_barrier>)
+define BUILD_CONFIG_H_template
+
+$(1) : $(wildcard $(CONFIG_FILE)) $(wildcard $(CONFIG_FILE)-default)
+ @$(QUIET_CMD_ECHO) " CONFGEN $$(@:$(MAKERULES_DIR)/%=%)"
+ @if [ ! -d `dirname $(1).tmp` ] ; then \
+ mkdir `dirname $(1).tmp` ; fi
+ @echo "/* Automatically generated from */" > "$(1).tmp"
+ @echo "/* config file: $$< */" >> "$(1).tmp"
+ @echo "#ifndef $(3)" >> "$(1).tmp"
+ @echo "#define $(3)" >> "$(1).tmp"
+ @( $(foreach x, $(shell echo '$($(2))' | sed -e 's/\<\([^ =]*\)\(=[^ ]\+\|\)\>/\1/g' ), \
+ echo '$(x).$($(x))' ; ) echo ; ) | \
+ sed -e '/^[^.]*\.n$$$$/d' -e '/^[^.]*\.$$$$/d' -e 's/^\([^.]*\)\.[ym]$$$$/\1.1/' | \
+ sed -n -e 's/^\([^.]*\)\.\(.*\)$$$$/#define \1 \2/p' \
+ >> "$(1).tmp"
+ @echo "#endif /*$(3)*/" >> "$(1).tmp"
+ @if cmp --quiet "$(1).tmp" "$(1)" ; then rm "$(1).tmp" ; \
+ else mv "$(1).tmp" "$(1)" ; \
+ echo Updated configuration "$(1)" ; fi
+
+endef
+
+ifdef LOCAL_CONFIG_H
+
+# This must be declared after the default cflags are assigned!
+# Override is used to override command line assignemnt.
+override CFLAGS += -I.
+$(eval $(call BUILD_CONFIG_H_template,$(LOCAL_CONFIG_H),default_CONFIG,_LOCAL_CONFIG_H) )
+
+endif
+
+# Special rules for configuration exported headers
+
+#FIXME: The directory for headers should not be specified here.
+$(foreach confh,$(config_include_HEADERS),$(eval $(call BUILD_CONFIG_H_template,$(addprefix $(USER_INCLUDE_DIR)/,$(confh)),$(basename $(notdir $(confh)))_DEFINES,\
+_$(basename $(notdir $(confh)))_H \
+)))
+
+# Add some hooks to standard passes
+include-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(config_include_HEADERS))
+
+clean-local: clean-local-config-h
+
+clean-local-config-h:
+ @$(foreach confh,$(addprefix $(USER_INCLUDE_DIR)/,$(config_include_HEADERS)),\
+ if [ -e $(confh) ] ; then touch -t 200001010101 $(confh) ; fi ; \
+ )
+
+
# Local Variables:
# mode:makefile
# End: