]> git.saurik.com Git - apt.git/blob - buildlib/program.mak
Brought in the GUI
[apt.git] / buildlib / program.mak
1 # -*- make -*-
2
3 # This creates a program
4
5 # Input
6 # $(SOURCE) - The source code to use
7 # $(PROGRAM) - The name of the program
8 # $(SLIBS) - Shared libs to link against
9
10 # See defaults.mak for information about LOCAL
11
12 # Some local definitions
13 LOCAL := $(PROGRAM)
14 $(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .o,$(notdir $(basename $(SOURCE)))))
15 $(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .d,$(notdir $(basename $(SOURCE)))))
16 $(LOCAL)-BIN := $(BIN)/$(PROGRAM)
17 $(LOCAL)-SLIBS := $(SLIBS)
18
19 # Install the command hooks
20 program: $(BIN)/$(PROGRAM)
21 clean: clean/$(LOCAL)
22 veryclean: veryclean/$(LOCAL)
23
24 # The clean rules
25 .PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
26 clean/$(LOCAL):
27 -rm -f $($(@F)-OBJS) $($(@F)-DEP)
28 veryclean/$(LOCAL): clean/$(LOCAL)
29 -rm -f $($(@F)-BIN)
30
31 # The binary build rule
32 $($(LOCAL)-BIN): $($(LOCAL)-OBJS)
33 echo Building program $@
34 $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LFLAGS) -o $@ $(filter %.o,$^) $($(LOCAL)-SLIBS)
35
36 # Compilation rules
37 vpath %.cc $(SUBDIRS)
38 $(OBJ)/%.o: %.cc
39 echo Compiling $< to $@
40 $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
41 $(DoDep)
42
43 # Include the dependencies that are available
44 The_DFiles = $(wildcard $($(LOCAL)-DEP))
45 ifneq ($(words $(The_DFiles)),0)
46 include $(The_DFiles)
47 endif