1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#
# Console APT Compilation Interface
#
CXXFLAGS = -I. -Iinit $(PICFLAGS)
include globalmakeflags
OBJS = $(subst .cc,.o,$(wildcard */*.cc))
BIN = capt
LDLIBS = $(LFLAGS) $(GPMLIB) $(APTPKGLIB) $(CURSESLIB)
DESTDIR = /usr/local
.PHONY: all bin clean distclean install
all: $(BIN)
$(BIN): $(OBJS)
$(CXX) -o $(BIN) $(OBJS) $(LDFLAGS) $(LDLIBS)
clean:
rm -f $(OBJS) $(BIN)
find . -regex '^.+\.?[od~]$$' -exec rm -f {} \;
distclean: clean
rm -rf debian/tmp
rm -f *-stamp build config.status config.log config.cache makefile configure init/config.h globalmakeflags
install:
install -d -m755 $(DESTDIR)/bin
install -s -m755 $(BIN) $(DESTDIR)/bin
install -d -m755 $(DESTDIR)/man/man1
ln -s $(BIN) $(DESTDIR)/bin/apt-find
ln -s $(BIN) $(DESTDIR)/bin/console-apt
# -- Dark magic below this point.
# Include the dependencies that are available
The_DFiles = $(wildcard */*.d)
ifneq ($(words $(The_DFiles)),0)
include $(The_DFiles)
endif
# Dependency generation. We want to generate a .d file using gnu cpp.
# For GNU systems the compiler can spit out a .d file while it is compiling,
# this is specified with the INLINEDEPFLAG. Other systems might have a
# makedep program that can be called after compiling, that's illistrated
# by the DEPFLAG case.
# Compile rules are expected to call this macro after calling the compiler
define DoDep
@sed -e "1s/.*:/$(subst /,\\/,$@):/" $(basename $(@F)).d > $(@F).d
@-rm -f $(basename $(@F)).d
@mv $(@F).d $(dir $@)
endef
%.o: %.cc
$(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
$(DoDep)
|