]> rtime.felk.cvut.cz Git - l4.git/blob - l4/mk/rules.inc
update
[l4.git] / l4 / mk / rules.inc
1 # vi:ft=make
2 # This makefile contains the generator for our basic pattern rules.
3 # These generators allow easy instantiation of own rule sets.
4
5 # variables for instantiating make rules.
6 # for C++ compile (CXX) use $(CXX), $(INT_CXX_NAME), and $(CXXFLAGS)
7 BID_CXX_COMPILER = CXX
8 BID_CXX_COMPILER_INT_NAME = INT_CXX_NAME
9 # for C compile (C) use $(CC), $(INT_CPP_NAME), and $(CFLAGS)
10 BID_C_COMPILER = CC
11 BID_C_COMPILER_INT_NAME = INT_CPP_NAME
12 # for AS compile (AS) use $(CC), $(INT_CPP_NAME), and $(ASFLAGS)
13 BID_AS_COMPILER = CC
14 BID_AS_COMPILER_INT_NAME = INT_CPP_NAME
15
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
26 $(1): $(2)
27         @$$(COMP_MESSAGE)
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)
30 endef
31
32 # Template for our make rules (make rules that do not use gendep)
33 define BID_MAKE_RULE_template_nongendep
34 $(1): $(2)
35         @$$(COMP_MESSAGE)
36         $$(VERBOSE)$$($(BID_$(3)_COMPILER)) -c $$(DEPFLAGS) $$(CPPFLAGS) $$($(3)FLAGS) $(4) $$(call absfilename,$$<) -o $$@
37 endef
38
39 # which template rule do we really use
40 BID_MAKE_RULE_template = $(BID_MAKE_RULE_template_gendep)
41
42 #
43 # Generate the default set of make rules.
44 # targets: .o, .s.o, .pr.o, and .pr.s.o
45 #
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)
51 endef
52
53 #
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
57 #
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))
62 endef
63
64 #
65 #
66 # Generate the C set of make rules.
67 # prerequisites: %.<arg1> (usually %.c)
68 # targets: %.o, %.s.o, %.pr.o, and %.pr.s.o
69 #
70 define BID_GENERATE_C_MAKE_RULES
71   $(call BID_GENERATE_DEFAULT_MAKE_RULES,%,%.$(1),C)
72 endef
73
74