summaryrefslogtreecommitdiff
path: root/build-0.3/c/cpp-options.make
blob: d6246a3ee6316e3f5d8361985293afe33466a58b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# file      : build/c/cpp-options.make
# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC
# license   : GNU GPL v2; see accompanying LICENSE file

$(out_base)/%.cpp-options: c-cpp-options-expand-impl = $(if $1,cat $1 >>$2)
$(out_base)/%.cpp-options: c-cpp-options-expand = \
$(call c-cpp-options-expand-impl,$(filter %.cpp-options,$1),$2)


#@@ Asymmetry: I hide creation commands but show removals.
#
$(out_base)/%.cpp-options: c-cpp-options-force-impl = \
$(if $(subst $1,,$2)$(subst $2,,$1),FORCE)

$(out_base)/%.cpp-options: c-cpp-options-force = \
$(call c-cpp-options-force-impl,$(shell if test -f $1; then exec head -n 1 $1; fi),include: $2)


# @@ Need to incroporate prefix: into force-check. Then it will probably
#    have to be non-optional.
#

ifeq ($(src_base),$(out_base))
$(out_base)/%.cpp-options: $$(call c-cpp-options-force,$$@,$$(value))
else
$(out_base)/%.cpp-options: $$(call c-cpp-options-force,$$@,$$(value)) | $$(dir $$@).
endif
	@echo "include: $(value)" >$@
	$(if $(strip $(prefix)),@echo "prefix: $(prefix)" >>$@)
	@$(call c-cpp-options-expand,$^,$@)

# Clean.
#
$(out_base)/%.cpp-options.clean:
	$(call message,rm $(basename $@),rm -f $(basename $@))