]> git.saurik.com Git - apple/objc4.git/blob - Makefile
objc4-267.tar.gz
[apple/objc4.git] / Makefile
1 # use LDFLAGS not LFLAGS
2 #
3 # Simple makefile for building objc4 on Darwin
4 #
5 # These make variables (or environment variables) are used
6 # when defined:
7 # SRCROOT path location of root of source hierarchy;
8 # defaults to ".", but must be set to a
9 # destination path for installsrc target.
10 # OBJROOT path location where .o files will be put;
11 # defaults to SRCROOT.
12 # SYMROOT path location where build products will be
13 # put; defaults to SRCROOT.
14 # DSTROOT path location where installed products will
15 # be put; defaults to / .
16 # OBJROOT and SYMROOT should not be directories shared with other
17 # built projects.
18 # PLATFORM name of platform being built on
19 # USER name of user building the project
20 # ARCHS list of archs for which to build
21 # RC_ARCHS more archs for which to build (build system)
22 # OTHER_CFLAGS other flags to be passed to compiler
23 # RC_CFLAGS more flags to be passed to compiler (build system)
24 # OTHER_LDFLAGS other flags to be passed to the link stage
25 #
26
27 # Default targets
28 default: build
29 all: build
30
31 .SUFFIXES:
32 .PHONY: default all build optimized debug profile installsrc installhdrs install clean prebuild build-optimized build-debug build-profile prebuild-optimized prebuild-debug prebuild-profile compile-optimized compile-debug compile-profile link-optimized link-debug link-profile postbuild
33
34 CURRENT_PROJECT_VERSION = 227
35
36 VERSION_NAME = A
37
38 # First figure out the platform if not specified, so we can use it in the
39 # rest of this file. Currently defined values: Darwin
40 ifeq "$(PLATFORM)" ""
41 PLATFORM := $(shell uname)
42 endif
43
44 ifndef SRCROOT
45 SRCROOT = .
46 endif
47
48 ifndef OBJROOT
49 OBJROOT = $(SRCROOT)
50 endif
51
52 ifndef SYMROOT
53 SYMROOT = $(SRCROOT)
54 endif
55
56 ifndef DSTROOT
57 DSTROOT = /
58 endif
59
60 ifeq "$(PLATFORM)" "Darwin"
61 CC = /usr/bin/cc
62 else
63 CC = /usr/bin/gcc
64 endif
65
66 ECHO = @/bin/echo
67 MKDIRS = /bin/mkdir -p
68 CD = cd
69 COPY = /bin/cp
70 COPY_RECUR = /bin/cp -r
71 REMOVE = /bin/rm
72 REMOVE_RECUR = /bin/rm -rf
73 SYMLINK = /bin/ln -s
74 CHMOD = /bin/chmod
75 CHOWN = /usr/sbin/chown
76 TAR = /usr/bin/tar
77 STRIP = /usr/bin/strip
78 NMEDIT = /usr/bin/nmedit
79 LIPO = /usr/bin/lipo
80
81 ifeq "$(PLATFORM)" "Darwin"
82 WARNING_FLAGS = -Wmost -Wno-precomp -Wno-four-char-constants
83 endif
84
85 ARCH_LIST=
86 ifeq "$(PLATFORM)" "Darwin"
87
88 ifneq "$(ARCHS)" ""
89 ARCH_LIST += $(ARCHS)
90 else
91 ifneq "$(RC_ARCHS)" ""
92 ARCH_LIST += $(RC_ARCHS)
93 else
94 ARCH_LIST += $(shell /usr/bin/arch)
95 endif
96 endif
97
98 ARCH_FLAGS = $(foreach A, $(ARCH_LIST), $(addprefix -arch , $(A)))
99
100 endif
101
102
103 ifeq "$(ORDERFILE)" ""
104 ORDERFILE = $(wildcard /usr/local/lib/OrderFiles/libobjc.order)
105 endif
106 ifneq "$(ORDERFILE)" ""
107 ORDER = -sectorder __TEXT __text $(ORDERFILE)
108 else
109 ORDER =
110 endif
111
112 ifeq "$(USER)" ""
113 USER = unknown
114 endif
115
116 CFLAGS = -g -fno-common -fobjc-exceptions -pipe $(PLATFORM_CFLAGS) $(WARNING_FLAGS) -I$(SYMROOT) -I. -I$(SYMROOT)/ProjectHeaders
117 LDFLAGS =
118
119 LIBRARY_EXT = .dylib
120
121 PUBLIC_HEADER_INSTALLDIR = usr/include/objc
122 OTHER_HEADER_INSTALLDIR = usr/local/include/objc
123 INSTALLDIR = usr/lib
124
125 ifeq "$(PLATFORM)" "Darwin"
126 LDFLAGS += -dynamiclib -dynamic -compatibility_version 1 -current_version $(CURRENT_PROJECT_VERSION)
127 endif
128
129
130 CFLAGS += $(OTHER_CFLAGS) $(RC_CFLAGS)
131 LDFLAGS += $(OTHER_LDFLAGS)
132
133 ifndef OPTIMIZATION_CFLAGS
134 OPTIMIZATION_CFLAGS = -Os
135 endif
136 ifndef DEBUG_CFLAGS
137 DEBUG_CFLAGS = -DDEBUG
138 endif
139 ifndef PROFILE_CFLAGS
140 PROFILE_CFLAGS = -DPROFILE -pg -Os
141 endif
142
143 CFLAGS_OPTIMIZED = $(OPTIMIZATION_CFLAGS) $(CFLAGS)
144 CFLAGS_DEBUG = $(DEBUG_CFLAGS) $(CFLAGS)
145 CFLAGS_PROFILE = $(PROFILE_CFLAGS) $(CFLAGS)
146
147 LDFLAGS_OPTIMIZED = $(LDFLAGS) -g
148 LDFLAGS_DEBUG = $(LDFLAGS) -g
149 LDFLAGS_PROFILE = $(LDFLAGS) -g -pg
150
151 SUBDIRS = . runtime runtime/OldClasses.subproj runtime/Messengers.subproj runtime/Auto.subproj
152
153 # files to compile
154 SOURCES=
155 # files to compile into separate linker modules
156 MODULE_SOURCES=
157 # files to not compile
158 OTHER_SOURCES=
159 # headers to install in /usr/include/objc
160 PUBLIC_HEADERS=