initial revision
[ucgine.git] / mk / ucgine-post.mk
1 #
2 # Copyright 2015, Olivier MATZ <zer0@droids-corp.org>
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are met:
6 #
7 #     * Redistributions of source code must retain the above copyright
8 #       notice, this list of conditions and the following disclaimer.
9 #     * Redistributions in binary form must reproduce the above copyright
10 #       notice, this list of conditions and the following disclaimer in the
11 #       documentation and/or other materials provided with the distribution.
12 #     * Neither the name of the University of California, Berkeley nor the
13 #       names of its contributors may be used to endorse or promote products
14 #       derived from this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 # DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #
27
28 # ---- variables that must be defined:
29 #
30 #  UCGINE: path to ucgine root
31 #
32 # ---- variable that can be defined anywhere
33 #
34 #  CROSS: prefix of the toolchain
35 #  CP, LN, GAWK, GREP: coreutils tools
36 #  CC, CPP, AR, LD, OBJCOPY, OBJDUMP, STRIP: compilers/binutils
37 #
38 # ---- variable that can be defined by Makefile:
39 #
40 #  obj-y-$(path)
41 #  exe-y-$(path)
42 #  ar-y-$(path)
43 #  shlib-y-$(path)
44 #  copy-y-$(path)
45 #  slink-y-$(path)
46 #  objcopy-y-$(path)
47 #  subdir-y
48 #
49 #  CPPFLAGS, CFLAGS, LDFLAGS, LDLIBS: global flags
50 #  cflags-$(path), cppflags-$(path), ldflags-$(path), ldlibs-$(path): per
51 #    file flags
52 #  mkflags-$(path): flags for subdirectories
53 #
54 # ---- variables that can be defined on the command line:
55 #
56 #  EXTRA_CPPFLAGS, EXTRA_CFLAGS, EXTRA_LDFLAGS, EXTRA_LDLIBS: global
57 #    extra flags
58 #  extra-cflags-$(path), extra-cppflags-$(path): per object extra flags
59
60 ifeq ($(UCGINE),)
61 $(error UCGINE environment variable is not defined)
62 endif
63
64 # list of targets asked by user
65 all-targets :=
66 # list of files generated
67 all-clean-file :=
68
69 # usual internal variables:
70 #   out-$(file) = output path of a generated file
71 #   pre-$(file) = list of files needed to generate $(file)
72 #   all-type = list of targets for this type
73
74 include $(UCGINE)/mk/ucgine-obj-vars.mk
75 include $(UCGINE)/mk/ucgine-exe-vars.mk
76 include $(UCGINE)/mk/ucgine-ar-vars.mk
77 include $(UCGINE)/mk/ucgine-shlib-vars.mk
78 include $(UCGINE)/mk/ucgine-copy-vars.mk
79 include $(UCGINE)/mk/ucgine-slink-vars.mk
80 include $(UCGINE)/mk/ucgine-objcopy-vars.mk
81 include $(UCGINE)/mk/ucgine-subdir-vars.mk
82 # must stay at the end
83 include $(UCGINE)/mk/ucgine-clean-vars.mk
84
85 # dump the list of targets
86 ifeq ($(D),1)
87 $(call disp_list,------ all-targets,$(all-targets))
88 endif
89
90 # first rule (default)
91 .PHONY: _ucgine_all
92 _ucgine_all: $(all-targets)
93
94 # the includes below require second expansion
95 .SECONDEXPANSION:
96
97 include $(UCGINE)/mk/ucgine-obj-rules.mk
98 include $(UCGINE)/mk/ucgine-exe-rules.mk
99 include $(UCGINE)/mk/ucgine-ar-rules.mk
100 include $(UCGINE)/mk/ucgine-shlib-rules.mk
101 include $(UCGINE)/mk/ucgine-copy-rules.mk
102 include $(UCGINE)/mk/ucgine-slink-rules.mk
103 include $(UCGINE)/mk/ucgine-objcopy-rules.mk
104 include $(UCGINE)/mk/ucgine-subdir-rules.mk
105 include $(UCGINE)/mk/ucgine-clean-rules.mk
106
107 .PHONY: FORCE
108 FORCE: