]> git.saurik.com Git - apt.git/blame - buildlib/program.mak
remove duplicated 'the' from guides doc-base abstract
[apt.git] / buildlib / program.mak
CommitLineData
1164783d
AL
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
1e3f4083 9# $(LIB_MAKES) - Shared library make files to depend on - to ensure we get
f760b7d2 10# remade when the shared library version increases.
1164783d
AL
11
12# See defaults.mak for information about LOCAL
13
14# Some local definitions
15LOCAL := $(PROGRAM)
16$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .o,$(notdir $(basename $(SOURCE)))))
62daa15f 17$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .o.d,$(notdir $(basename $(SOURCE)))))
1164783d
AL
18$(LOCAL)-BIN := $(BIN)/$(PROGRAM)
19$(LOCAL)-SLIBS := $(SLIBS)
f760b7d2 20$(LOCAL)-MKS := $(addprefix $(BASE)/,$(LIB_MAKES))
1164783d
AL
21
22# Install the command hooks
23program: $(BIN)/$(PROGRAM)
24clean: clean/$(LOCAL)
25veryclean: veryclean/$(LOCAL)
26
80948457
AL
27TYPE = src
28include $(PODOMAIN_H)
29
b2e465d6
AL
30# Make Directories
31MKDIRS += $(OBJ) $(DEP) $(BIN)
32
1164783d 33# The clean rules
67ff87bf 34.PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
1164783d
AL
35clean/$(LOCAL):
36 -rm -f $($(@F)-OBJS) $($(@F)-DEP)
37veryclean/$(LOCAL): clean/$(LOCAL)
38 -rm -f $($(@F)-BIN)
39
67ff87bf
AL
40# The convience binary build rule
41.PHONY: $(PROGRAM)
42$(PROGRAM): $($(LOCAL)-BIN)
43
1164783d 44# The binary build rule
f760b7d2 45$($(LOCAL)-BIN): $($(LOCAL)-OBJS) $($(LOCAL)-MKS)
1164783d 46 echo Building program $@
c3c77d09 47 $(CXX) $(CXXSTD) $(CXXFLAGS) $(LDFLAGS) $(LFLAGS) -o $@ $(filter %.o,$^) $($(@F)-SLIBS) $(LEFLAGS)
1164783d
AL
48
49# Compilation rules
50vpath %.cc $(SUBDIRS)
51$(OBJ)/%.o: %.cc
52 echo Compiling $< to $@
85a67355 53 $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXSTD) $(CXXFLAGS) -o $@ '$(abspath $<)'
1164783d
AL
54 $(DoDep)
55
56# Include the dependencies that are available
57The_DFiles = $(wildcard $($(LOCAL)-DEP))
58ifneq ($(words $(The_DFiles)),0)
59include $(The_DFiles)
60endif