4 # Use this file with make to compile and install Yoink.
6 # This makefile supports these targets:
7 # all, install, clean, cleandist, run, debug
9 # This build system incorporates the ideas written by Emile van Bergen:
10 # http://www.xs4all.nl/~evbergen/nonrecursive-make.html
14 # Define some options.
17 # Set this to `yes' to echo each build command.
22 # Include the configuration file, config.mk.
25 have_config := $(wildcard config.mk)
26 ifneq ($(strip $(have_config)),)
30 @echo "You must run the configure script before you can make anything."
36 # Some standard stuff.
40 .SUFFIXES: .a .c .cc .cpp .o .rc
46 # Include the subdirectories--order is not important.
50 include $(dir)/rules.mk
53 include $(dir)/rules.mk
56 include $(dir)/rules.mk
60 # Define some common rules.
63 CC_WRAPPER = ./build/compile.sh $(CC)
64 CXX_WRAPPER = ./build/compile.sh $(CXX)
67 DO_CC = @echo " CC $@";
68 DO_CXX = @echo " CXX $@";
69 DO_LD = @echo " LD $@";
70 DO_LDX = @echo " LD $@";
71 DO_CCLD = @echo " CCLD $@";
72 DO_CXXLD = @echo " CXXLD $@";
73 DO_AR = @echo " AR $@";
74 DO_RC = @echo " RC $@";
77 DO_CC += $(CC_WRAPPER) $(CFLAGS) $(CF_TGT) -o $@ -c $<
78 DO_CXX += $(CXX_WRAPPER) $(CXXFLAGS) $(CF_TGT) -o $@ -c $<
79 DO_LD += $(CC_WRAPPER) $(LDFLAGS) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LIBS)
80 DO_LDX += $(CXX_WRAPPER) $(LDFLAGS) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LIBS)
81 DO_CCLD += $(CC_WRAPPER) $(CFLAGS) $(CF_TGT) $(LDFLAGS) $(LF_TGT) -o $@ $< $(LL_TGT) $(LIBS)
82 DO_CXXLD += $(CXX_WRAPPER) $(CXXFLAGS) $(CF_TGT) $(LDFLAGS) $(LF_TGT) -o $@ $< $(LL_TGT) $(LIBS)
83 DO_AR += $(AR) rcs $@ $^; $(RANLIB) $@
84 DO_RC += $(WINDRES) $(DDEFINES) $(DF_TGT) -o $@ -i $<
110 #TGT_BIN := $(addsuffix $(EXEEXT),$(TGT_BIN))
114 # Define the phony targets.
118 targets: $(TGT_BIN) $(TGT_LIB)
122 ifeq ($(verbose),yes)
125 @echo " CLEAN"; rm -f $(CLEAN)
130 ifeq ($(verbose),yes)
138 $(INSTALL) $(TGT_BIN) -m 755 -d $(DESTDIR)$(bindir)
139 $(INSTALL) $(TGT_DATA) -m 644 -d $(DESTDIR)$(datadir)
140 $(INSTALL) $(TGT_LIB) -m 750 -d $(DESTDIR)$(libdir)
141 $(INSTALL) $(TGT_MAN) -m 644 -d $(DESTDIR)$(mandir)
145 # Prevent make from removing any build targets.