1 |
# binary build rules
|
2 |
# Control Variables
|
3 |
# -----------------
|
4 |
# buildsrcfiles
|
5 |
# binname
|
6 |
# SharedSuffix
|
7 |
# ArchiveSuffix
|
8 |
|
9 |
# ------ <Build> targets ----
|
10 |
include $(TOOL_HOME)/BuildSystem/objectfiles.mk
|
11 |
|
12 |
binname=$(buildname)
|
13 |
ifneq ($(strip $(buildsrcfiles)),)
|
14 |
ifndef binfiles
|
15 |
binfiles=$(basename $(buildsrcfiles))
|
16 |
endif
|
17 |
bin_%:: binmsg dependencies.mk
|
18 |
bin_opt:: $(binname)_opt
|
19 |
bin_debug:: $(binname)_d
|
20 |
bin_debug_local:: $(binname)_d
|
21 |
bin_insure:: $(binname)_insure
|
22 |
else
|
23 |
bin_%::
|
24 |
@echo No file specified
|
25 |
endif
|
26 |
|
27 |
|
28 |
# -- Set the binary vpaths
|
29 |
VPATH+=$(binstore):$(RELEASETOP)/$(INTbin)
|
30 |
|
31 |
.PHONY: binmsg
|
32 |
binmsg::
|
33 |
@echo --------------- $(binname) --------------
|
34 |
|
35 |
|
36 |
#------------------------------------------------
|
37 |
# Set up some system variables
|
38 |
# - all begin with S
|
39 |
#------------------------------------------------
|
40 |
# -- Libraries for Debug Executables
|
41 |
|
42 |
lib_d=$(shell $(TOOL_HOME)/LibTypeExpand "_d" $(lib))
|
43 |
lib_d_l=$(shell $(TOOL_HOME)/LibTypeExpandLocal "_d" $(lib))
|
44 |
LDLIBS_D=$(addprefix -l,$(lib_d))
|
45 |
LDLIBS_D_L=$(addprefix -l,$(lib_d_l))
|
46 |
|
47 |
# -- Libraries for Insure Executables
|
48 |
lib_Insure1=$(shell $(TOOL_HOME)/LibTypeExpand "_Insure" $(lib))
|
49 |
lib_Insure=$(shell $(TOOL_HOME)/LibTypeExpandLocal "_d" $(lib_Insure1))
|
50 |
lib_Insure_l1=$(shell $(TOOL_HOME)/LibTypeExpandLocal "_Insure" $(lib))
|
51 |
lib_Insure_l=$(shell $(TOOL_HOME)/LibTypeExpandLocal "_d" $(lib_Insure_l1))
|
52 |
LDLIBS_Insure=$(addprefix -l,$(lib_Insure))
|
53 |
|
54 |
Sdebugobjs:=$(addsuffix _d.o,$(binfiles))
|
55 |
Sbinobjs:=$(addsuffix _o.o,$(binfiles))
|
56 |
Spicbinobjs:=$(addsuffix _pic.o,$(binfiles))
|
57 |
SInsureobjs:=$(addsuffix _Insure.o,$(binfiles))
|
58 |
SpicInsureobjs:=$(addsuffix _picInsure.o,$(binfiles))
|
59 |
|
60 |
# Now more specific rules
|
61 |
|
62 |
$(binname)_d: $(Sdebugobjs)
|
63 |
$(CClinkCmdDebug)
|
64 |
@$(SCRAM_HOME)/src/scramdatestamp $@.ds $@ $^
|
65 |
@cp $(binname)_d $(binarystore)/$(binname)
|
66 |
|
67 |
$(binname)_opt: $(Sbinobjs)
|
68 |
$(CClinkCmd)
|
69 |
@$(SCRAM_HOME)/src/scramdatestamp $@.ds $@ $^
|
70 |
@cp $(binname)_opt $(binarystore)/$(binname)
|
71 |
|
72 |
$(binname)_insure: $(SInsureobjs)
|
73 |
$(CClinkCmdInsure)
|
74 |
@$(SCRAM_HOME)/src/scramdatestamp $@.ds $@ $^
|
75 |
@cp $(binname)_insure $(binarystore)/$(binname)_insure
|
76 |
|
77 |
# -- cleaning targets
|
78 |
clean::clean_$(binname) clean_$(binname)_insure clean_d
|
79 |
|
80 |
clean_% ::
|
81 |
@bin=$(subst clean_,,$@); \
|
82 |
if [ -f $(binarystore)/$$bin ]; then \
|
83 |
echo Removing executable $(binarystore)/$$bin; \
|
84 |
rm $(binarystore)/$$bin; \
|
85 |
fi;
|
86 |
|
87 |
# -- dependencies
|
88 |
-include $(binname).dep
|
89 |
dependencies.mk:: $(buildsrcfiles)
|
90 |
@if [ "$<" != "" ]; then \
|
91 |
echo Generating Dependencies; \
|
92 |
$(DependencyCCTool); \
|
93 |
$(TOOL_HOME)/DependencyMangler $@; \
|
94 |
fi
|
95 |
|