-# Version for system-less builds. #OMK@sysless
+# Makefile.rules - OCERA make framework common project rules -*- makefile-gmake -*- #OMK:base.omk
#
-# Makefile.rules - OCERA make framework common project rules -*- makefile -*- #OMK@base
-#
-# (C) Copyright 2003 by Pavel Pisa - OCERA team member
-# (C) Copyright 2006 by Michal Sojka - Czech Technical University, FEE, DCE
+# (C) Copyright 2003, 2006, 2007, 2008, 2009 by Pavel Pisa - OCERA team member
+# (C) Copyright 2006, 2007, 2008, 2009, 2010 by Michal Sojka - Czech Technical University, FEE, DCE
#
# Homepage: http://rtime.felk.cvut.cz/omk/
+# Version: 0.2-27-g254fd61
#
# The OMK build system is distributed under the GNU General Public
# License. See file COPYING for details.
#
-# input variables
+#
+# Version for system-less builds. #OMK:sysless.omk
+#
+#
+# input variables #OMK:base.omk
# V .. if set to 1, full command text is shown else short form is used
# 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 ...
-# LN_HEADERS .. if "y", header files are symbolicaly linked instead of copied. #OMK@include
-# #OMK@sysless
-# bin_PROGRAMS .. list of the require binary programs
+# LN_HEADERS .. if "y", header files are symbolicaly linked instead of copied. #OMK:include.omk
+# bin_PROGRAMS .. list of the require binary programs #OMK:sysless.omk
# test_PROGRAMS .. list of the test programs
# include_HEADERS .. list of the user-space public header files
# lib_LIBRARIES .. list of the user-space libraries
# should be used for linking (e.g. ram flash). If this is not
# specified, then the value of DEFAULT_LD_SCRIPT_VARIANT from config.target is used.
# PREFIX_DIR .. Prefix to directories in _compiled and _build. Used in config.omk.
-# LOCAL_CONFIG_H .. name of local config.h file generated from values #OMK@config_h
+# LOCAL_CONFIG_H .. name of local config.h file generated from values #OMK:config_h.omk
# of options defined in the current directory
# config_include_HEADERS .. names of global config files (possibly
# with subdirectories)
# DOXYGEN .. if non-empty, generated headers includes Doxygen's @file
# command, so it is possible to document config
# variables.
-# local_EVALUATE .. Makefile hook, which is executed at the end of #OMK@localeval
+# local_EVALUATE .. Makefile hook, which is executed at the end of #OMK:localeval.omk
# the Makefile.rules. Used only for dirty hacks.
-OMK_RULES_TYPE=sysless #OMK@__type
- #OMK@base
-# We need to ensure definition of sources directory first
-ifndef SOURCES_DIR
-# Only shell built-in pwd understands -L
-SOURCES_DIR := $(shell ( pwd -L ) )
-endif
-
+OMK_RULES_TYPE=sysless #OMK:Makefile.rules.sysless@
+ #OMK:base.omk@Makefile.rules.sysless
# If we are not called by OMK leaf Makefile...
ifndef MAKERULES_DIR
MAKERULES_DIR := $(abspath $(dir $(filter %Makefile.rules,$(MAKEFILE_LIST))))
OUTPUT_DIR := $(MAKERULES_DIR)
endif
-.PHONY: all default check-make-ver omkize
+# We need to ensure definition of sources directory first
+ifndef SOURCES_DIR
+# Only shell built-in pwd understands -L
+SOURCES_DIR := $(shell ( pwd -L ) )
+INVOCATION_DIR := $(SOURCES_DIR:$(OUTPUT_DIR)%=%)
+INVOCATION_DIR := $(INVOCATION_DIR:/%=%)
+INVOCATION_DIR := $(INVOCATION_DIR:\\%=%)
+endif
+
+.PHONY: all default check-make-ver print-hints omkize
ifdef W
ifeq ("$(origin W)", "command line")
endif
ifneq ($(OMK_WHOLE_TREE),1)
-all: check-make-ver default
+all: check-make-ver print-hints default
@echo "Compilation finished"
else
# Run make in the top-level directory
#=========================
# Include the config file
-# FIXME: I think CONFIG_FILE_OK variable is useless. We have three
-# config files and it is not clearly defined to which file is this
-# variable related.
-ifneq ($(CONFIG_FILE_OK),y)
ifndef CONFIG_FILE
CONFIG_FILE := $(OUTPUT_DIR)/config.omk
endif
-ifneq ($(wildcard $(CONFIG_FILE)-default),)
--include $(CONFIG_FILE)-default
-else
-ifneq ($(MAKECMDGOALS),default-config)
-$(warning Please, run "make default-config" first)
+
+$(CONFIG_FILE)-default:
+ $(MAKE) default-config
+
+ifeq ($(MAKECMDGOALS),default-config)
+export DEFAULT_CONFIG_PASS=1
endif
+
+ifneq ($(DEFAULT_CONFIG_PASS),1)
+include $(CONFIG_FILE)-default
endif
-include $(OUTPUT_DIR)/config.target
ifneq ($(wildcard $(CONFIG_FILE)),)
-include $(CONFIG_FILE)
-CONFIG_FILE_OK = y
endif
-endif #$(CONFIG_FILE_OK)
CONFIG_FILES ?= $(wildcard $(CONFIG_FILE)-default) $(wildcard $(OUTPUT_DIR)/config.target) $(wildcard $(CONFIG_FILE))
-export SOURCES_DIR MAKERULES_DIR RELATIVE_DIR
+export SOURCES_DIR MAKERULES_DIR RELATIVE_DIR INVOCATION_DIR
export CONFIG_FILE CONFIG_FILES OMK_SERIALIZE_INCLUDED OMK_VERBOSE OMK_SILENT
# OMK_SERIALIZE_INCLUDED has to be exported to submakes because passes
# must to be serialized only in the toplevel make.
override RELATIVE_DIR := $(RELATIVE_DIR:/%=%)
override RELATIVE_DIR := $(RELATIVE_DIR:\\%=%)
#$(warning RELATIVE_DIR = "$(RELATIVE_DIR)")
-override BACK2TOP_DIR := $(shell echo $(RELATIVE_DIR)/ | sed -e 's_//_/_g' -e 's_/\./_/_g' -e 's_^\./__g' -e 's_\([^/][^/]*\)_.._g' -e 's_/$$__')
+#override BACK2TOP_DIR := $(shell echo $(RELATIVE_DIR)/ | sed -e 's_//_/_g' -e 's_/\./_/_g' -e 's_^\./__g' -e 's_\([^/][^/]*\)_.._g' -e 's_/$$__')
#$(warning BACK2TOP_DIR = "$(BACK2TOP_DIR)")
#$(warning SOURCES_DIR = "$(SOURCES_DIR)")
OMK_INCLUDED := 1
endif
+print-hints:
+ @echo 'Use "make V=1" to see the verbose compile lines.'
+
check-make-ver:
@GOOD_MAKE_VERSION=`echo $(MAKE_VERSION) | sed -n -e 's/^[4-9]\..*\|^3\.9[0-9].*\|^3\.8[1-9].*/y/p'` ; \
if [ x$$GOOD_MAKE_VERSION != xy ] ; then \
pass = $(strip $(1))
+unexport SUBDIRS
+
# Call a pass in a subdirectory
# Usage: $(call omk_pass_subdir_template,<pass name>,<build dir>,<subdir>)
define omk_pass_subdir_template
.PHONY: $(pass)-$(3)-subdir
$(pass)-submakes: $(pass)-$(3)-subdir
+$(pass)-$(3)-subdir: MAKEOVERRIDES:=$(filter-out SUBDIRS=%,$(MAKEOVERRIDES))
$(pass)-$(3)-subdir:
@$(call mkdir_def,$(2)/$(3))
+@$(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(3) $(NO_PRINT_DIRECTORY) \
RELATIVE_DIR=$(RELATIVE_PREFIX)$(3) -C $(2)/$(3) \
-f $(SUBDIR_MAKEFILE) $(pass)-submakes
# In subdirectories we can call submakes directly since passes are
-# already searialized on the toplevel make.
+# already serialized on the toplevel make.
endef
ifdef OMK_TESTSROOT
fi
$(Q)for i in `find -L . -name Makefile.omk` ; do \
d=`dirname $${i}`; \
- if ! test -f "$${d}/Makefile.rules" && ( ! test -f "$${d}/Makefile" || ! cmp --silent Makefile "$${d}/Makefile" ); then \
+ if ! test -f "$${d}/Makefile.rules" && ( test -f "$${d}/Makefile" && ! cmp --silent Makefile "$${d}/Makefile" ); then \
rm -f "$${d}/Makefile"; \
cp -v Makefile "$${d}/Makefile"; \
fi \
done
- #OMK@gcc
+ #OMK:gcc.omk@Makefile.rules.sysless
# Rules for compilation of C, C++ and assembler sources using GNU
# toolchain.
-include $(OBJS_DIR)/*.d
+SOURCES2OBJS = .o/.c .o/.cc .o/.cxx .o/.S .o/.o
+
+SOURCES2OBJSLO = .lo/.c .lo/.cc .lo/.cxx .lo/.S .lo/.lo
+
#%.lo: %.c
# $(CC) -o $@ $(LCFLAGS) -c $<
$(Q)if [ -n `dirname $$@` ] ; then \
if [ ! -e `dirname $$@` ] ; then \
mkdir -p `dirname $$@` ; fi ; fi
- $(Q)echo >$$@ '/* Automatically generated from $$< */'
- $(Q)echo >>$$@ '/* Conditionals to control compilation */'
- $(Q)set -o pipefail ; $(NM) $$< \
+ $(Q)echo >$$@.tmp '/* Automatically generated from $$< */'
+ $(Q)echo >>$$@.tmp '/* Conditionals to control compilation */'
+# Bellow, the tricks with redirection are for shells without set -o pipefail
+# (see http://www.mail-archive.com/dash@vger.kernel.org/msg00149.html)
+ $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) $$<; echo $$$$? >&4; }\
| sed -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2cond_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
- | sort >>$$@
- $(Q)echo >>$$@ '/* Defines from the values defined to symbols */'
- $(Q)set -o pipefail ; $(NM) $$< \
+ | sort >>$$@.tmp` && exit $$$$status
+ $(Q)echo >>$$@.tmp '/* Defines from the values defined to symbols in hexadecimal format */'
+ $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) $$<; echo $$$$? >&4; }\
| sed -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2def_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
- | sort >>$$@
+ | sort >>$$@.tmp` && exit $$$$status
+ $(Q)echo >>$$@.tmp '/* Defines from the values defined to symbols in decimal format */'
+ $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) -td $$<; echo $$$$? >&4; }\
+ | sed -n 's/^ *0*\(0\|[1-9][0-9]*\) *A *_cmetric2defdec_\([A-Za-z_0-9]*\) */#define \2 \1/p' \
+ | sort >>$$@.tmp` && exit $$$$status
+ $(Q)mv $$@.tmp $$@
endef
# Syntax: $(call PROGRAM_template,<executable-name>,<dir>,<link-variant>)
define PROGRAM_template
-$(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.c=%.o))
-$(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cc=%.o))
-$(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cxx=%.o))
-$(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.S=%.o))
-$(1)_OBJS += $$(filter %.o,$(1)_SOURCES)
-$(1)_OBJS := $$(sort $$($(1)_OBJS))
+
+GEN_SOURCES += $$($(1)_GEN_SOURCES)
+
+$(foreach x, $(SOURCES2OBJS),
+$(1)_OBJS += $$(patsubst %$(notdir $(x)),%$(dir $(x)),$$(filter %$(notdir $(x)),\
+ $$($(1)_SOURCES) $$($(1)_GEN_SOURCES)))
+)
+$(1)_OBJS := $$(sort $$($(1)_OBJS:%/=%))
SOURCES += $$($(1)_SOURCES)
then echo $$(CC) $$(CPPFLAGS) $$(AM_CPPFLAGS) $$(AM_CFLAGS) $$(CFLAGS) ; \
else echo $$(CXX) $$(CPPFLAGS) $$(AM_CPPFLAGS) $$(AM_CXXFLAGS) $$(CXXFLAGS) ; fi) \
$$(AM_LDFLAGS) $$(LDFLAGS) $$($(1)$(3:%=-%)_LDFLAGS) -Wl,-Map,$(1)$(3:%=-%).map \
- $$($(1)_OBJS) $$(LOADLIBES) $$($(1)_MOREOBJS) $$($(1)_LIBS:%=-l%) \
+ $$($(1)_OBJS) $$($(1)_MOREOBJS) $$(LOADLIBES) $$($(1)_LIBS:%=-l%) \
-o $$@
@echo "$(2)/$(1)$(3:%=-%): \\" >$(OBJS_DIR)/$(1)$(3:%=-%).exe.d
@if [ -n "$(LD_SCRIPT)" ]; then \
# Syntax: $(call LIBRARY_template,<library-name>)
define LIBRARY_template
-$(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.c=%.o))
-$(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cc=%.o))
-$(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cxx=%.o))
-$(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.S=%.o))
-$(1)_OBJS := $$(sort $$($(1)_OBJS))
+
+GEN_SOURCES += $$($(1)_GEN_SOURCES)
+
+$(foreach x, $(SOURCES2OBJS),
+$(1)_OBJS += $$(patsubst %$(notdir $(x)),%$(dir $(x)),$$(filter %$(notdir $(x)),\
+ $$($(1)_SOURCES) $$($(1)_GEN_SOURCES)))
+)
+$(1)_OBJS := $$(sort $$($(1)_OBJS:%/=%))
SOURCES += $$($(1)_SOURCES)
# Syntax: $(call SOLIB_template,<library-name>)
define SOLIB_template
-$(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.c=%.lo))
-$(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.cc=%.lo))
-$(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.cxx=%.lo))
-$(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.S=%.lo))
-$(1)_OBJSLO := $$(sort $$($(1)_OBJSLO))
+
+SOLIB_GEN_SOURCES += $$($(1)_GEN_SOURCES)
+
+$(foreach x, $(SOURCES2OBJSLO),
+$(1)_OBJSLO += $$(patsubst %$(notdir $(x)),%$(dir $(x)),$$(filter %$(notdir $(x)),\
+ $$($(1)_SOURCES) $$($(1)_GEN_SOURCES)))
+)
+$(1)_OBJSLO := $$(sort $$($(1)_OBJSLO:%/=%))
SOLIB_OBJS += $$($(1)_OBJSLO)
SOLIB_SOURCES += $$($(1)_SOURCES)
@$(QUIET_CMD_ECHO) " LINK $$@"
$(Q) $(LD) --shared --soname=lib$(1).so -o $$@ $$^
endef
-
-# Local Variables:
-# mode:makefile
-# End:
-ifeq ($(OMK_VERBOSE),1) #OMK@include
+ifeq ($(OMK_VERBOSE),1) #OMK:include.omk@Makefile.rules.sysless
CPHEADER_FLAGS += -v
LNHEADER_FLAGS += -v
endif
ifneq ($(LN_HEADERS),y)
define cp_cmd
-( echo " CP $(1:$(OUTPUT_DIR)/%=%) -> $(2:$(OUTPUT_DIR)/%=%)"; cp $(CPHEADER_FLAGS) $(1) $(2) )
+if ! cmp --quiet $(1) $(2); then \
+ echo " CP $(1:$(OUTPUT_DIR)/%=%) -> $(2:$(OUTPUT_DIR)/%=%)"; \
+ install -C -D $(CPHEADER_FLAGS) $(1) $(2) || exit 1; \
+fi
endef
else
define cp_cmd
-( echo " LN $(1:$(OUTPUT_DIR)/%=%) -> $(2:$(OUTPUT_DIR)/%=%)"; [ -f $(1) ] && ln -sf $(LNHEADER_FLAGS) $(1) $(2) )
+if ! cmp --quiet $(1) $(2); then \
+ echo " LN $(1:$(OUTPUT_DIR)/%=%) -> $(2:$(OUTPUT_DIR)/%=%)"; \
+ if [ -f $(1) ]; then d=$(2); mkdir -p $${d%/*} && ln -sf $(LNHEADER_FLAGS) $(1) $(2) || exit 1; else exit 1; fi; \
+fi
endef
endif
# Syntax: $(call include-pass-template,<include dir>,<keyword>)
define include-pass-template
include-pass-local: include-pass-local-$(2)
-include-pass-local-$(2): $$($(2)_GEN_HEADERS) $$(foreach f,$$(renamed_$(2)_GEN_HEADERS),$$(shell echo '$$(f)' | sed -e 's/^\(.*\)->.*$$$$/\1/'))
- @$$(foreach f, $$($(2)_HEADERS), cmp --quiet $$(SOURCES_DIR)/$$(f) $(1)/$$(notdir $$(f)) \
- || $$(call cp_cmd,$$(SOURCES_DIR)/$$(f),$(1)/$$(notdir $$(f))) || exit 1 ; )
- @$$(foreach f, $$($(2)_GEN_HEADERS), cmp --quiet $$(f) $(1)/$$(notdir $$(f)) \
- || $$(call cp_cmd,$$(LOCAL_BUILD_DIR)/$$(f),$(1)/$$(notdir $$(f))) || exit 1 ; ) # FIXME: Use correct build dir, then document it
- @$$(foreach f, $$(nobase_$(2)_HEADERS), cmp --quiet $$(SOURCES_DIR)/$$(f) $(1)/$$(f) \
- || ( mkdir -p $(1)/$$(dir $$(f)) && $$(call cp_cmd,$$(SOURCES_DIR)/$$(f),$(1)/$$(f)) ) || exit 1 ; )
+include-pass-local-$(2): $$($(2)_GEN_HEADERS) $$(foreach f,$$(renamed_$(2)_GEN_HEADERS),$$(shell f='$$(f)'; echo $$$${f%->*}))
+ @$$(foreach f, $$($(2)_HEADERS),$$(call cp_cmd,$$(SOURCES_DIR)/$$(f),$(1)/$$(notdir $$(f))); )
+# FIXME: Use correct build dir, then document it (in the line bellow)
+ @$$(foreach f, $$($(2)_GEN_HEADERS),$$(call cp_cmd,$$(LOCAL_BUILD_DIR)/$$(f),$(1)/$$(notdir $$(f))); )
+ @$$(foreach f, $$(nobase_$(2)_HEADERS), $$(call cp_cmd,$$(SOURCES_DIR)/$$(f),$(1)/$$(f)); )
@$$(foreach f, $$(renamed_$(2)_HEADERS), \
- srcfname=`echo '$$(f)' | sed -e 's/^\(.*\)->.*$$$$/\1/'` ; destfname=`echo '$$(f)' | sed -e 's/^.*->\(.*\)$$$$/\1/'` ; \
- cmp --quiet $$(SOURCES_DIR)/$$$${srcfname} $(1)/$$$${destfname} \
- || ( mkdir -p `dirname $(1)/$$$${destfname}` && $$(call cp_cmd,$$(SOURCES_DIR)/$$$${srcfname},$(1)/$$$${destfname}) ) || exit 1 ; )
+ f='$$(f)'; srcfname=$$$${f%->*}; destfname=$$$${f#*->}; \
+ $$(call cp_cmd,$$(SOURCES_DIR)/$$$${srcfname},$(1)/$$$${destfname}); )
@$$(foreach f, $$(renamed_$(2)_GEN_HEADERS), \
- srcfname=`echo '$$(f)' | sed -e 's/^\(.*\)->.*$$$$/\1/'` ; destfname=`echo '$$(f)' | sed -e 's/^.*->\(.*\)$$$$/\1/'` ; \
- cmp --quiet $$$${srcfname} $(1)/$$$${destfname} \
- || ( mkdir -p `dirname $(1)/$$$${destfname}` && $$(call cp_cmd,$$(LOCAL_BUILD_DIR)/$$$${srcfname},$(1)/$$$${destfname}) ) || exit 1 ; )
+ f='$$(f)'; srcfname=$$$${f%->*}; destfname=$$$${f#*->}; \
+ $$(call cp_cmd,$$(LOCAL_BUILD_DIR)/$$$${srcfname},$(1)/$$$${destfname}); )
+# Suppress "Nothing to be done for `include-pass-local'" message if no headers are defined in Makefile.omk
+ @$$(if $$($(2)_HEADERS)$$($(2)_GEN_HEADERS)$$(nobase_$(2)_HEADERS)$$(renamed_$(2)_HEADERS)$$(renamed_$(2)_GEN_HEADERS),,true)
endef
-
-# Local Variables:
-# mode:makefile
-# End:
- #OMK@sysless
+ #OMK:sysless.omk@Makefile.rules.sysless
BUILD_DIR_NAME = _build$(addprefix /,$(PREFIX_DIR))
COMPILED_DIR_NAME = _compiled$(addprefix /,$(PREFIX_DIR))
# User-space static libraries and applications object files
SOURCES := $(sort $(SOURCES))
#$(warning SOURCES = $(SOURCES))
+GEN_SOURCES := $(sort $(GEN_SOURCES))
# User-space shared libraries object files
SOLIB_SOURCES := $(sort $(SOLIB_SOURCES))
#$(warning SOLIB_SOURCES = $(SOLIB_SOURCES))
+SOLIB_GEN_SOURCES := $(sort $(SOLIB_GEN_SOURCES))
+# Create _build directories for sources in subdirectories i.e. *_SOURCES=dir/file.c
+_dirs_to_create=$(filter-out ./,$(sort $(dir $(SOURCES) $(SOLIB_SOURCES))))
+ifneq ($(_dirs_to_create),)
+$(shell mkdir -p $(addprefix $(LOCAL_BUILD_DIR)/,$(_dirs_to_create)))
+endif
# The above generated rules produced $(SOURCES) and $(SOLIB_SOURCES)
# variables. Now generate rules for compilation of theese sources
$(foreach src,$(filter %.cc,$(SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cc=%$(OBJ_EXT)),)))
$(foreach src,$(filter %.cxx,$(SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cxx=%$(OBJ_EXT)),)))
$(foreach src,$(filter %$(ASM_EXT),$(SOURCES)),$(eval $(call COMPILE_S_o_template,$(SOURCES_DIR)/$(src),$(src:%$(ASM_EXT)=%$(OBJ_EXT)),)))
+$(foreach src,$(filter %.c,$(GEN_SOURCES)),$(eval $(call COMPILE_c_o_template,$(src),$(src:%.c=%.o),)))
$(foreach src,$(filter %.c,$(SOLIB_SOURCES)),$(eval $(call COMPILE_c_o_template,$(SOURCES_DIR)/$(src),$(src:%.c=%.lo),$(SOLIB_PICFLAGS))))
$(foreach src,$(filter %.cc,$(SOLIB_SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cc=%.lo),$(SOLIB_PICFLAGS))))
$(foreach src,$(filter %.cxx,$(SOLIB_SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cxx=%.lo),$(SOLIB_PICFLAGS))))
$(foreach src,$(filter %$(ASM_EXT),$(SOLIB_SOURCES)),$(eval $(call COMPILE_S_o_template,$(SOURCES_DIR)/$(src),$(src:%$(ASM_EXT)=%.lo),$(SOLIB_PICFLAGS))))
+$(foreach src,$(filter %.c,$(SOLIB_GEN_SOURCES)),$(eval $(call COMPILE_c_o_template,$(src),$(src:%.c=%.lo),$(SOLIB_PICFLAGS))))
library-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(cmetric_include_HEADERS)) \
$(lib_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%$(LIB_EXT)) $(shared_LIBRARIES:%=$(LIB_DIR)/$(LIB_PREF)%.so) \
# Used to load program to the target hardware
define LOAD_PROGRAM_template
.PHONY: load-$(1)$(3:%=-%)
-load-$(1)$(3:%=-%): $(2)/$(1)$(3:%=-%)$(LOAD_EXTENSION)
+load-$(1)$(3:%=-%): $(2)/$(1)$(3:%=-%)$(if $(LOAD_EXTENSION-$(3)),$(LOAD_EXTENSION-$(3)),$(LOAD_EXTENSION))
@$(QUIET_CMD_ECHO) " LOAD $$<"
@if [ -z '$$(LOAD_CMD$(3:%=-%))' ]; then echo "No command for loading applications to '$(3)' is specified."; exit 1; fi
$(Q) $$(LOAD_CMD$(3:%=-%)) $$<
$(USER_OBJS_DIR)/*.map \
$(LOCAL_CONFIG_H:%=$(USER_OBJS_DIR)/%)
-check-dir:
+check-dir::
@$(call mkdir_def,$(USER_INCLUDE_DIR))
@$(call mkdir_def,$(USER_LIB_DIR))
@$(call mkdir_def,$(USER_BIN_DIR))
include-pass-submakes: extra-rules-subdirs
# Which passes to pass
default: include-pass library-pass binary-pass utils-pass
-
-# Local Variables:
-# mode:makefile
-# End:
- #OMK@config_h
+ #OMK:config_h.omk@Makefile.rules.sysless
# Syntax: $(call BUILD_CONFIG_H_template,<stamp_dir>,<header_file_path>,<list_of_options_to_export>,<header_barrier>)
define BUILD_CONFIG_H_template
$(addprefix $(1)/,$(notdir $(addsuffix .stamp,$(2)))) : $(CONFIG_FILES)
- @$(QUIET_CMD_ECHO) " CONFGEN $$(@:%.stamp=%)"
+ @$(QUIET_CMD_ECHO) " CONFGEN $(notdir $(2))"
@if [ ! -d `dirname $(2).tmp` ] ; then \
mkdir -p `dirname $(2).tmp` ; fi
@echo "/* Automatically generated from */" > "$(2).tmp"
@$(foreach confh,$(config_h_stamp_files) $(kern_config_h_stamp_files),\
if [ -e $(confh) ] ; then rm $(confh) ; fi ; \
)
-
-
-# Local Variables:
-# mode:makefile
-# End:
- #OMK@sources-list
+ #OMK:sources-list.omk@Makefile.rules.sysless
# Rules that creates the list of files which are used during
# compilation. The list reflects conditional compilation depending on
# config.omk and other variables.
export SOURCES_LIST SOURCES_LIST_DIR SOURCES_LIST_D
endif
-ifeq ($(MAKECMDGOALS),sources-list)
-NEED_SOURCES_LIST=y
-endif
-ifeq ($(MAKECMDGOALS),TAGS)
-NEED_SOURCES_LIST=y
-endif
-ifeq ($(MAKECMDGOALS),tags)
+ifneq ($(filter sources-list TAGS tags cscope,$(MAKECMDGOALS)),)
NEED_SOURCES_LIST=y
endif
cscope: $(SOURCES_LIST)
@$(QUIET_CMD_ECHO) " CSCOPE < $(SOURCES_LIST_FN)"
- $(Q)sed -e '/^#/d' $(SOURCES_LIST)|cscope -b -i-
+ $(Q)sed -e '/^#/d' $(SOURCES_LIST) > cscope.files
+ $(Q)cscope -b -icscope.files
#FIXME: see doc to -i in cscope(1)
-
-# Local Variables:
-# mode:makefile
-# End:
- #OMK@localeval
+ #OMK:localeval.omk@Makefile.rules.sysless
ifneq ($(local_EVALUATE),)
#$(warning $(local_EVALUATE))
$(eval $(local_EVALUATE))
endif
-
-# Local Variables:
-# mode:makefile
-# End: