1
1
#_______________________________________________________________________________
3
# edam's general-purpose makefile
4
#_______________________________________________________________________________
6
# Copyright (c) 2008 Tim Marston <edam@waxworlds.org>.
8
# Permission is hereby granted, free of charge, to any person obtaining a copy
9
# of this software and associated documentation files (the "Software"), to deal
10
# in the Software without restriction, including without limitation the rights
11
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
# copies of the Software, and to permit persons to whom the Software is
13
# furnished to do so, subject to the following conditions:
15
# The above copyright notice and this permission notice shall be included in
16
# all copies or substantial portions of the Software.
18
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
#_______________________________________________________________________________
28
# This is a general-purpose makefile for use with GNU make. It can be downloaded
29
# from http://www.waxworlds.org/edam/software/general-purpose-makefile where you
30
# might also find more information/documentation on it's use. The following text
31
# can only really be considered a reference to it's use.
33
# To use this makefile, put a file named "Makefile" in your project directory.
34
# Add all your project's settings to your Makefile and then include this file
35
# from it. For example, your Makefile might look something like this:
38
# SOURCES = main.cc foo.cc
40
# include ~/src/edam.mk
42
# A complete list of all the settings you can use in your Makefile follows. It
43
# should be noted, though, that some settings are better defined in the shell's
44
# environment and/or specified on the make command line than hard-coded straight
45
# in to the Makefile. For example, the "DEBUGMODE" is an ideal candidate for
46
# exporting from your shell:
48
# and overridding on the command line when necessary:
51
# It should also be noted that boolean parameters should either be undefined (or
52
# defined as an empty string) for "off", and defined as "1" for "on"; as in the
53
# above example with setting DEBUGMODE.
55
# Here is a list of all configuration parameters:
57
# DEBUGMODE Boolean. Build a debugable version of the target suitable for
58
# debugging with gdb. It's probably better to set this from the
59
# command line or the shell's environment than to hard-code it.
60
# PROFILEMODE Boolean. When set, DEBUGMODE is also implied. Build a profiling
61
# version of the target, for use with gprof. It's probably better
62
# to set this from the command line or the shell's environment
63
# than to hard-code it.
65
# LINKSTATIC Boolean. Set to build a target that staticly links against all
66
# its libraries and doesn't use shared libraries.
68
# MKSTATICLIB Boolean. Target type: Set to build a static library target. If
69
# neither this nor MKSHAREDLIB are set, the target defaults to a
71
# MKSHAREDLIB Boolean. Target type: Set to build a shared library target. If
72
# neither this nor MKSTATICLIB are set, the target defaults to a
75
# TARGET The name of the target file.
77
# SOURCES A list of all source files of whatever language. The language
78
# type is determined by the file extension.
80
# LIBRARIES A list of libraries to link against. Don't include the 'lib'
83
# SUBDIRS A list of subdirectories to build before attempting to build the
84
# target. These subdirectories are also included in a clean_all.
86
# CPPFLAGS Flags to give to the C and C++ compilers
87
# CFLAGS Flags to give to the C compiler
88
# CXXFLAGS Flags to give to the C++ compiler
89
# DFLAGS Flags to give to the D compiler
90
# ASFLAGS Flags to give to the assembler
91
# LDFLAGS Flags to give to the linker before librarys
92
# LDPOSTFLAGS Flags to give to the linker after libraries
94
# This general-purpose makefile also defines the following goals for use on the
95
# command line when you run make:
97
# all This is the default if no goal is specified. It builds subdirs
98
# first and then the target.
100
# subdirs Changes to the subdirectories specified for the project and runs
103
# target Builds the target of your Makefile.
105
# run Builds the target of your Makefile and, if successful, runs it.
106
# This is not available if you're building a library of some kind.
108
# clean Deletes temporary files.
110
# clean_all Deletes temporary files and then goes through then project's
111
# subdirectories doing the same.
113
# <subdir> Builds the specified subdirectory from those that are listed for
116
# <file> Builds the specified file, either an object file or the target,
117
# from those that that would be built for the project.
119
# Please report any problems to Tim Marston <edam@waxworlds.org>
121
# Known shortcommings:
122
# - Using C is probably broken because g++ is currently used for linking. We
123
# should switch to ld and specify the correct crt as required by source files.
124
# - Currently can only specify one target. If we could specify several targets
125
# though, we'd need separate sources, libraries and build params for each!
127
#_______________________________________________________________________________
3
# edam's general-purpose makefile v2.4
4
#_______________________________________________________________________________
9
# (better to specify in environment/command line)
11
#export DEBUGMODE := 1
12
#export PROFILEMODE := 1
13
#export LINKSTATIC := 1
16
# target binary/library
28
# libraries to link against
33
# subdirectories to make first
38
# additional build flags
48
#_______________________________________________________________________________
130
51
# set debug mode if profiling