4 # Use this file with make to compile and install Yoink.
6 # This makefile supports these targets:
7 # all, install, clean, distclean, run, debug, dist, dist-gzip, dist-bzip2
9 # This build system incorporates the ideas written by Emile van Bergen:
10 # http://www.xs4all.nl/~evbergen/nonrecursive-make.html
13 # Set this to `true' to echo each build command in full.
16 # Set this to `false' to avoid installing manual pages.
21 # Include the configuration file, config.mk.
26 have_config := $(wildcard config.mk)
27 ifneq ($(strip $(have_config)),)
30 $(error You must run the configure script before you can make anything)
35 # Declare the default targets and implicit rules.
42 .SUFFIXES: .a .c .cc .cpp .in .o .rc
46 # Define some useful functions.
49 add_exe_suffix = $(addsuffix $(EXEEXT),$1)
50 remove_silencer = $(1:@%=%)
54 # Include the subdirectories--order is not important.
58 include $(dir)/rules.mk
61 include $(dir)/rules.mk
64 include $(dir)/rules.mk
68 # Define some common rules.
71 ifeq ($(DEP_TRACKING),true)
72 COMPILE = ./tools/compile.lua
75 ifeq ($(DEP_MINIMIZING),true)
76 LINK = ./tools/link.lua
79 INSTALL = ./tools/install.lua
81 # Include current directory to allow sources to #include "config.h".
85 COMMAND_CC = $(COMPILE) $(CC) $(CFLAGS) $(CF_TGT) -o $@ -c $<
86 COMMAND_CXX = $(COMPILE) $(CXX) $(CXXFLAGS) $(CF_TGT) -o $@ -c $<
87 COMMAND_LD = $(LINK) $(CC) $(LDFLAGS) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LIBS)
88 COMMAND_LDX = $(LINK) $(CXX) $(LDFLAGS) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LIBS)
89 COMMAND_CCLD = $(COMPILE) $(CC) $(CFLAGS) $(CF_TGT) $(LDFLAGS) $(LF_TGT) -o $@ $< $(LL_TGT) $(LIBS)
90 COMMAND_CXXLD = $(COMPILE) $(CXX) $(CXXFLAGS) $(CF_TGT) $(LDFLAGS) $(LF_TGT) -o $@ $< $(LL_TGT) $(LIBS)
91 COMMAND_AR = $(AR) rcs $@ $^; $(RANLIB) $@
92 COMMAND_RC = $(WINDRES) -I. $(DF_TGT) -o $@ -i $<
93 COMMAND_INSTALL = $(INSTALL) -m $1 $2 $3/
95 COMMAND_IN = sed -f config.sed <"$1" >"$2"
97 ifeq ($(verbose),true)
99 DO_CXX = $(COMMAND_CXX)
100 DO_LD = $(COMMAND_LD)
101 DO_LDX = $(COMMAND_LDX)
102 DO_CCLD = $(COMMAND_CCLD)
103 DO_CXXLD = $(COMMAND_CXXLD)
104 DO_AR = $(COMMAND_AR)
105 DO_RC = $(COMMAND_RC)
106 DO_INSTALL = $(COMMAND_INSTALL)
107 DO_RM = $(COMMAND_RM)
108 DO_IN = $(COMMAND_IN)
111 DO_CC = @echo " CC $@"; $(COMMAND_CC)
112 DO_CXX = @echo " CXX $@"; $(COMMAND_CXX)
113 DO_LD = @echo " LINK $@"; $(COMMAND_LD)
114 DO_LDX = @echo " LINK $@"; $(COMMAND_LDX)
115 DO_CCLD = @echo " LINK $@"; $(COMMAND_CCLD)
116 DO_CXXLD = @echo " LINK $@"; $(COMMAND_CXXLD)
117 DO_AR = @echo " AR $@"; $(COMMAND_AR)
118 DO_RC = @echo " RC $@"; $(COMMAND_RC)
119 DO_INSTALL = @echo " CP $2"; $(COMMAND_INSTALL)
120 DO_RM = @echo " RM $1"; $(COMMAND_RM)
121 DO_IN = @echo " GEN $2"; $(COMMAND_IN)
122 SHELL_LINE_PREFIX = @
127 # Define the implicit rules.
153 # Define the phony targets.
158 $(SHELL_LINE_PREFIX)files='$(CLEAN)'; for file in $$files; \
160 $(call remove_silencer,$(call DO_RM,$$file)); \
165 $(call DO_RM,config.h)
166 $(call DO_RM,config.mk)
167 $(call DO_RM,config.sed)
170 all_: $(BINARIES) $(MANPAGES)
174 $(SHELL_LINE_PREFIX)files='$(DATAFILES)'; for file in $$files; \
176 full=`echo "$$file" | cut -d\; -f1`; \
177 base=`echo "$$file" | cut -d\; -f2`; \
178 $(call remove_silencer,$(call DO_INSTALL,644,$$full,$(DESTDIR)$(datadir)$$base)); \
180 $(SHELL_LINE_PREFIX)files='$(BINARIES)'; for file in $$files; \
182 $(call remove_silencer,$(call DO_INSTALL,755,$$file,$(DESTDIR)$(bindir))); \
184 ifeq ($(install_man),true)
185 $(SHELL_LINE_PREFIX)files='$(MANPAGES)'; for file in $$files; \
187 $(call remove_silencer,$(call DO_INSTALL,644,$$file,$(DESTDIR)$(mandir))); \
193 $(SHELL_LINE_PREFIX)files='$(BINARIES)'; for file in $$files; \
195 base="/`basename $$file`"; \
196 $(call remove_silencer,$(call DO_RM,$(DESTDIR)$(bindir)$$base)); \
198 $(SHELL_LINE_PREFIX)files='$(DATAFILES)'; for file in $$files; \
200 full="`echo "$$file" | cut -d\; -f1`"; \
201 base="`echo "$$file" | cut -d\; -f2`/`basename $$full`"; \
202 $(call remove_silencer,$(call DO_RM,$(DESTDIR)$(datadir)$$base)); \
207 $(SHELL_LINE_PREFIX)git archive HEAD --prefix='$(TARNAME)/' | bzip2 > "$(TARNAME).tar.bz2"
211 $(SHELL_LINE_PREFIX)git archive HEAD --prefix='$(TARNAME)/' | gzip > "$(TARNAME).tar.gz"
218 # Prevent make from removing any build targets.