3 # This creates a program
6 # $(SOURCE) - The source code to use
7 # $(PROGRAM) - The name of the program
8 # $(SLIBS) - Shared libs to link against
9 # $(LIB_MAKES) - Shared libary make files to depend on - to ensure we get
10 # remade when the shared library version increases.
12 # See defaults.mak for information about LOCAL
14 # Some local definitions
16 $(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .o,$(notdir $(basename $(SOURCE)))))
17 $(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .o.d,$(notdir $(basename $(SOURCE)))))
18 $(LOCAL)-BIN := $(BIN)/$(PROGRAM)
19 $(LOCAL)-SLIBS := $(SLIBS)
20 $(LOCAL)-MKS := $(addprefix $(BASE)/,$(LIB_MAKES))
22 # Install the command hooks
23 program: $(BIN)/$(PROGRAM)
25 veryclean: veryclean/$(LOCAL)
28 MKDIRS += $(OBJ) $(DEP) $(BIN)
31 .PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
33 -rm -f $($(@F)-OBJS) $($(@F)-DEP)
34 veryclean/$(LOCAL): clean/$(LOCAL)
37 # The convience binary build rule
39 $(PROGRAM): $($(LOCAL)-BIN)
41 # The binary build rule
42 $($(LOCAL)-BIN): $($(LOCAL)-OBJS) $($(LOCAL)-MKS)
43 echo Building program $@
44 $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LFLAGS) -o $@ $(filter %.o,$^) $($(@F)-SLIBS) $(LEFLAGS)
49 echo Compiling $< to $@
50 $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
53 # Include the dependencies that are available
54 The_DFiles = $(wildcard $($(LOCAL)-DEP))
55 ifneq ($(words $(The_DFiles)),0)