2 # This makefile contains the generator for our basic pattern rules.
3 # These generators allow easy instantiation of own rule sets.
5 # variables for instantiating make rules.
6 # for C++ compile (CXX) use $(CXX), $(INT_CXX_NAME), and $(CXXFLAGS)
8 BID_CXX_COMPILER_INT_NAME = INT_CXX_NAME
9 # for C compile (C) use $(CC), $(INT_CPP_NAME), and $(CFLAGS)
11 BID_C_COMPILER_INT_NAME = INT_CPP_NAME
12 # for AS compile (AS) use $(CC), $(INT_CPP_NAME), and $(ASFLAGS)
14 BID_AS_COMPILER_INT_NAME = INT_CPP_NAME
16 # Template for our make rules.
17 # arg1: the target or target pattern (e.g., %.o)
18 # arg2: the prerequisites (e.g., %.c)
19 # arg3: the compiler pattern, used for determining the compiler
20 # variables and default flags (e.g., CXX). The rule uses
21 # $($(BID_<arg3>_COMPILER)) as compiler,
22 # $($(BID_<arg3>_COMPILER_INT_NAME)) for gendep, and
23 # $(<arg3>FLAGS) as flags
24 # arg4: extra command line flags for the compile
25 define BID_MAKE_RULE_template_gendep
28 $$(VERBOSE)$$(call MAKEDEP,$$($(BID_$(3)_COMPILER_INT_NAME))) $$($(BID_$(3)_COMPILER)) -c $$(DEPEND_FLAG) $$(CPPFLAGS) $$($(3)FLAGS) $(4) $$(call absfilename,$$<) -o $$@
29 $$(DEPEND_VERBOSE)$$(call DEPEND_EXTEND_FUNC, $$(*F).d, $$(dir $$@).$$(notdir $$@).d)
32 # Template for our make rules (make rules that do not use gendep)
33 define BID_MAKE_RULE_template_nongendep
36 $$(VERBOSE)$$($(BID_$(3)_COMPILER)) -c $$(DEPFLAGS) $$(CPPFLAGS) $$($(3)FLAGS) $(4) $$(call absfilename,$$<) -o $$@
39 # which template rule do we really use
40 BID_MAKE_RULE_template = $(BID_MAKE_RULE_template_gendep)
43 # Generate the default set of make rules.
44 # targets: .o, .s.o, .pr.o, and .pr.s.o
46 define BID_GENERATE_DEFAULT_MAKE_RULES
47 $(call BID_MAKE_RULE_template,$(1).o,$(2),$(3),$(4))
48 $(call BID_MAKE_RULE_template,$(1).s.o,$(2),$(3),$(4) $$(PICFLAGS))
49 $(call BID_MAKE_RULE_template,$(1).pr.o,$(2),$(3),$(4) -DPROFILE -pg)
50 $(call BID_MAKE_RULE_template,$(1).pr.s.o,$(2),$(3),$(4) $$(PICFLAGS) -DPROFILE -pg)
54 # Generate the C++ set of make rules.
55 # prerequisites: %.<arg1> (usually %.cc)
56 # targets: %.o, %.s.o, %.ne.o, %.s.ne.o, %.pr.o, and %.pr.s.o
58 define BID_GENERATE_CXX_MAKE_RULES
59 $(call BID_GENERATE_DEFAULT_MAKE_RULES,%,%.$(1),CXX)
60 $(call BID_MAKE_RULE_template,%.ne.o,%.$(1),CXX,$$(CXXFLAGS_NOEXC))
61 $(call BID_MAKE_RULE_template,%.s.ne.o,%.$(1),CXX,$$(CXXFLAGS_NOEXC) $$(PICFLAGS))
66 # Generate the C set of make rules.
67 # prerequisites: %.<arg1> (usually %.c)
68 # targets: %.o, %.s.o, %.pr.o, and %.pr.s.o
70 define BID_GENERATE_C_MAKE_RULES
71 $(call BID_GENERATE_DEFAULT_MAKE_RULES,%,%.$(1),C)
75 # arg 1: target pattern
79 define BID_GENERATE_I_MAKE_RULE
82 $$(VERBOSE)$(3) -E -H -dD $$(CPPFLAGS) $(4) $$(call absfilename,$$<) -o $$@
83 $$(VERBOSE)$$(if $$(DO_SHOW_RESULT_FILE),$$(PAGER) $$@)
87 # arg 1: source pattern
90 define BID_GENERATE_S_MAKE_RULE
93 $$(VERBOSE)$(2) -S $(3) $(CPPFLAGS) $$(call absfilename,$$<) -fverbose-asm -o $$@