Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame^] | 1 | ### |
| 2 | # Configuration variables. |
| 3 | |
| 4 | # Assume make is always run from top-level of source directory. Note |
| 5 | # than an Apple style build overrides these variables later in the |
| 6 | # makefile. |
| 7 | ProjSrcRoot := $(shell pwd) |
| 8 | ProjObjRoot := $(ProjSrcRoot) |
| 9 | |
| 10 | Configs := Debug Release Profile |
| 11 | Archs := i386 ppc x86_64 |
| 12 | |
| 13 | Common.CFLAGS := -Wall -Werror |
| 14 | |
| 15 | # These names must match the configs, see GetArgs function. |
| 16 | Debug.CFLAGS := -g |
| 17 | Release.CFLAGS := -O3 -fomit-frame-pointer |
| 18 | Profile.CFLAGS := -pg -g |
| 19 | |
| 20 | # Function: GetArgs config arch |
| 21 | # |
| 22 | # Return the compiler flags for the given config & arch. |
| 23 | GetArgs = $(if $($(1).CFLAGS),$(Common.CFLAGS) $($(1).CFLAGS) -arch $(2), \ |
| 24 | $(error "Invalid configuration: $(1)")) |
| 25 | |
| 26 | ### |
| 27 | # Tool configuration variables. |
| 28 | |
| 29 | CC := gcc |
| 30 | # FIXME: LLVM uses autoconf/mkinstalldirs ? |
| 31 | MKDIR := mkdir -p |
| 32 | DATE := date |
| 33 | AR := ar |
| 34 | # FIXME: Remove these pipes once ranlib errors are fixed. |
| 35 | AR.Flags := cru 2> /dev/null |
| 36 | RANLIB := ranlib |
| 37 | # FIXME: Remove these pipes once ranlib errors are fixed. |
| 38 | RANLIB.Flags := 2> /dev/null |
| 39 | LIPO := lipo |
| 40 | |
| 41 | ### |
| 42 | # Automatic and derived variables. |
| 43 | |
| 44 | # Adjust settings for verbose mode |
| 45 | ifndef VERBOSE |
| 46 | Verb := @ |
| 47 | else |
| 48 | Verb := |
| 49 | endif |
| 50 | |
| 51 | Echo := @echo |
| 52 | Archive := $(AR) $(AR.Flags) |
| 53 | Ranlib := $(RANLIB) $(RANLIB.Flags) |
| 54 | Lipo := $(LIPO) |
| 55 | ifndef Summary |
| 56 | Summary = $(Echo) |
| 57 | endif |