]> git.saurik.com Git - apt.git/blame - buildlib/program.mak
M68k patch
[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
f760b7d2
AL
9# $(LIB_MAKES) - Shared libary make files to depend on - to ensure we get
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
b2e465d6
AL
27# Make Directories
28MKDIRS += $(OBJ) $(DEP) $(BIN)
29
1164783d 30# The clean rules
67ff87bf 31.PHONY: clean/$(LOCAL) veryclean/$(LOCAL)
1164783d
AL
32clean/$(LOCAL):
33 -rm -f $($(@F)-OBJS) $($(@F)-DEP)
34veryclean/$(LOCAL): clean/$(LOCAL)
35 -rm -f $($(@F)-BIN)
36
67ff87bf
AL
37# The convience binary build rule
38.PHONY: $(PROGRAM)
39$(PROGRAM): $($(LOCAL)-BIN)
40
1164783d 41# The binary build rule
f760b7d2 42$($(LOCAL)-BIN): $($(LOCAL)-OBJS) $($(LOCAL)-MKS)
1164783d 43 echo Building program $@
a9975068 44 $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LFLAGS) -o $@ $(filter %.o,$^) $($(@F)-SLIBS) $(LEFLAGS)
1164783d
AL
45
46# Compilation rules
47vpath %.cc $(SUBDIRS)
48$(OBJ)/%.o: %.cc
49 echo Compiling $< to $@
50 $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
51 $(DoDep)
52
53# Include the dependencies that are available
54The_DFiles = $(wildcard $($(LOCAL)-DEP))
55ifneq ($(words $(The_DFiles)),0)
56include $(The_DFiles)
57endif