2 # --- GSMP-COPYRIGHT-NOTE-BEGIN ---
4 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Please add additional copyright information _after_ the line containing
6 # the GSMP-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
7 # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
10 # General Sound Manipulation Program is Copyright (C) 2000 - 2003
11 # Valentin Ziegler and René Rebe
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; version 2. A copy of the GNU General
16 # Public License can be found at LICENSE.
18 # This program is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANT-
20 # ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
21 # Public License for more details.
23 # --- GSMP-COPYRIGHT-NOTE-END ---
25 # The Rules containing all the tricky rules - some details
26 # are inspired from the Linux 2.6 kbuild Makefiles ...
29 ifeq ($(origin TOPDIR), undefined)
33 # Set CCD (current compile dir) to an initial .
34 ifeq ($(origin CCD), undefined)
38 # Do not print "Entering directory ..."
39 MAKEFLAGS += --no-print-directory
47 override HOSTCFLAGS += -Wall -Wshadow
49 override HOSTCXXFLAGS += -Wall -Wshadow
51 # set CROSS_COMPILE to the arch you want to compile for ...
53 CC = $(CROSS_COMPILE)gcc
54 CXX = $(CROSS_COMPILE)g++
56 override CFLAGS += -Wall -ggdb
58 override CXXFLAGS += -Wall -ggdb
62 # enable pch if supported
67 # enable pch STL if supported
69 override CXXFLAGS += -include bits/stdc++.h -Winvalid-pch
72 .PHONY: subdirs $(SUBDIRS)
75 # do not remove intermediate object files
77 # do not remove generated files
78 .PRECIOUS: $(GENERATED)
80 # a tiny help for manual use
83 $(Q)$(CXX) $(CXXFLAGS) $(INCLUDES) $(LIBS) $(LDFLAGS) -o $@ $^
86 # prevent warning for dirs with subdirs only
92 @echo ' ENTERING $(CCD)/$@ ...'
93 $(Q)$(MAKE) -C $@ CCD="$(CCD)/$@" $(MAKECMDGOALS)
94 @echo ' LEAVING $(CCD)/$@ ...'
96 # Pre Compiled Headers
99 $(Q)$(CXX) $(CXXFLAGS) $(INCLUDES) $^ || true
102 @echo ' LINK EXEC $@'
103 $(Q)$(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)
105 # the ugly sed code is needed for creation of empty targets - so removed
106 # dependencies are ignored - and the target rebuilds as expected
108 @echo ' DEP $(@:.o=.d)'
109 $(Q)$(CXX) -MM $(CXXFLAGS) $(INCLUDES) $< | sed '/^#.*/d' > $(@:.o=.d)
110 $(Q)sed -e 's/^[^:]*: *//' -e 's/ \\$$//' \
111 -e 's/^ *//g' -e 's/ /:\n/g' -e 's/$$/:/' $(@:.o=.d) >> $(@:.o=.d)
113 $(Q)$(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
115 # the -Xlinker -rpath mangling is needed to find those libraries during
116 # linking for other objects
119 $(Q)$(CXX) -shared $(CXXFLAGS) $(LDFLAGS) $(LIBS) \
120 $(patsubst -L%, -Xlinker -rpath %, $(filter -L%, $(LIBS))) -o $@ $^
132 @rm -vf $(BUILD_OBJS) $(BUILD_LIBS) $(BUILD_PROGS) $(GENERATED) $(DEPS)
133 @rm -vf conftest.* config.{tmp,log}
136 distclean: subdirs clean clean-pch
137 @rm -vf *~ *.d $(PCHS)
138 @rm -vf config.{h,make}