1 # use LDFLAGS not LFLAGS
3 # Simple makefile for building objc4 on Darwin
5 # These make variables (or environment variables) are used
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
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
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
34 CURRENT_PROJECT_VERSION = 227
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
41 PLATFORM := $(shell uname)
60 ifeq "$(PLATFORM)" "Darwin"
67 MKDIRS = /bin/mkdir -p
70 COPY_RECUR = /bin/cp -r
72 REMOVE_RECUR = /bin/rm -rf
75 CHOWN = /usr/sbin/chown
77 STRIP = /usr/bin/strip
78 NMEDIT = /usr/bin/nmedit
81 ifeq "$(PLATFORM)" "Darwin"
82 WARNING_FLAGS = -Wmost -Wno-precomp -Wno-four-char-constants
86 ifeq "$(PLATFORM)" "Darwin"
91 ifneq "$(RC_ARCHS)" ""
92 ARCH_LIST += $(RC_ARCHS)
94 ARCH_LIST += $(shell /usr/bin/arch)
98 ARCH_FLAGS = $(foreach A, $(ARCH_LIST), $(addprefix -arch , $(A)))
103 ifeq "$(ORDERFILE)" ""
104 ORDERFILE = $(wildcard /usr/local/lib/OrderFiles/libobjc.order)
106 ifneq "$(ORDERFILE)" ""
107 ORDER = -sectorder __TEXT __text $(ORDERFILE)
116 CFLAGS = -g -fno-common -fobjc-exceptions -pipe $(PLATFORM_CFLAGS) $(WARNING_FLAGS) -I$(SYMROOT) -I. -I$(SYMROOT)/ProjectHeaders
121 PUBLIC_HEADER_INSTALLDIR = usr/include/objc
122 OTHER_HEADER_INSTALLDIR = usr/local/include/objc
125 ifeq "$(PLATFORM)" "Darwin"
126 LDFLAGS += -dynamiclib -dynamic -compatibility_version 1 -current_version $(CURRENT_PROJECT_VERSION)
130 CFLAGS += $(OTHER_CFLAGS) $(RC_CFLAGS)
131 LDFLAGS += $(OTHER_LDFLAGS)
133 ifndef OPTIMIZATION_CFLAGS
134 OPTIMIZATION_CFLAGS = -Os
137 DEBUG_CFLAGS = -DDEBUG
139 ifndef PROFILE_CFLAGS
140 PROFILE_CFLAGS = -DPROFILE -pg -Os
143 CFLAGS_OPTIMIZED = $(OPTIMIZATION_CFLAGS) $(CFLAGS)
144 CFLAGS_DEBUG = $(DEBUG_CFLAGS) $(CFLAGS)
145 CFLAGS_PROFILE = $(PROFILE_CFLAGS) $(CFLAGS)
147 LDFLAGS_OPTIMIZED = $(LDFLAGS) -g
148 LDFLAGS_DEBUG = $(LDFLAGS) -g
149 LDFLAGS_PROFILE = $(LDFLAGS) -g -pg
151 SUBDIRS = . runtime runtime/OldClasses.subproj runtime/Messengers.subproj runtime/Auto.subproj
155 # files to compile into separate linker modules
157 # files to not compile
159 # headers to install in /usr/include/objc