1 # Makefile for striptease project
2 # Copyright (C) 2011,2012 Kyle J. McKay. All rights reserved.
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
5 # of this software and associated documentation files (the "Software"), to
6 # deal in the Software without restriction, including without limitation the
7 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 # sell copies of the Software, and to permit persons to whom the Software is
9 # furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice shall be included in
12 # all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 # Except as contained in this notice, the name of the author(s) shall not
22 # be used in advertising or otherwise to promote the sale, use or other
23 # dealings in this Software without prior written authorization from the
38 XSDK
:= $(shell xcode-select
-print-path
2>/dev
/null
)
42 ifeq (0,$(shell test -d
'$(XSDK)/Platforms/MacOSX.platform/Developer/SDKs'; echo
$$?
))
43 XSDK
:= $(XSDK
)/Platforms
/MacOSX.platform
/Developer
/SDKs
45 ifeq (0,$(shell test -d
'$(XSDK)/SDKs'; echo
$$?
))
49 ifneq ($(MAKECMDGOALS
),clean)
50 $(error Could not find Developer SDKs directory
)
56 OSXNUVER
:= $(shell uname
-r | cut
-d.
-f1
)
57 OSXNUVERACTUAL
:= $(shell uname
-r | cut
-d.
-f1
)
59 ifeq (0,$(shell test -d
'$(XSDK)/MacOSX10.4u.sdk'; echo
$$?
))
64 $(shell mkdir
-p build
/Release
/libstuff
)
67 LDEXTRA
=$(ARCH
) -Wl
,-S
-Wl
,-x
69 $(shell mkdir
-p build
/Debug
/libstuff
)
75 # The 10.4u SDK can be used, but do not require it except on 10.4.x
76 # Always build x86_64 if actually running on 10.5 or later
78 ifneq ($(OSXNUVERACTUAL
),8)
79 ARCH
= -arch x86_64
-arch i386
-arch ppc
80 ARCH
+= -Xarch_ppc
-mmacosx-version-min
=10.4
81 ARCH
+= -Xarch_ppc
-isysroot
$(XSDK
)/MacOSX10.4u.sdk
82 ARCH
+= -Xarch_i386
-mmacosx-version-min
=10.4
83 ARCH
+= -Xarch_i386
-isysroot
$(XSDK
)/MacOSX10.4u.sdk
84 ARCH
+= -Xarch_x86_64
-mmacosx-version-min
=10.5
85 ARCH
+= -Xarch_x86_64
-isysroot
$(XSDK
)/MacOSX10.5.sdk
87 ARCH
= -arch i386
-arch ppc
88 ARCH
+= -mmacosx-version-min
=10.4 -isysroot
$(XSDK
)/MacOSX10.4u.sdk
91 ARCH
= -arch x86_64
-arch i386
-arch ppc
92 ARCH
+= -Xarch_ppc
-mmacosx-version-min
=10.4
93 ARCH
+= -Xarch_i386
-mmacosx-version-min
=10.4
94 ARCH
+= -Xarch_x86_64
-mmacosx-version-min
=10.5
95 ARCH
+= -isysroot
$(XSDK
)/MacOSX10.5.sdk
98 COPTS
+= -include preinc.h
-DCCTOOLSVER
=$(CCTOOLSVER
)
100 LDOPTS
= -Wl
,-no_uuid
-Wl
,-dead_strip
-Wl
,-multiply_defined
,suppress
105 .PHONY
: tools tease
strip install_name_tool
107 tools
: strip install_name_tool tease
113 install_name_tool
: $(DD
)install_name_tool
115 LIBSTUFF_SRC
:= $(wildcard libstuff
/*.c
)
125 INSTALL_NAME_TOOL_SRC
= \
126 install_name_tool.c \
129 TEASE_OBJS
= $(addprefix $(DD
),$(TEASE_SRC
:.c
=.o
)) $(DD
)version_tease.o
131 STRIP_OBJS
= $(addprefix $(DD
),$(STRIP_SRC
:.c
=.o
)) $(DD
)version_strip.o
133 INSTALL_NAME_TOOL_OBJS
= $(addprefix $(DD
),$(INSTALL_NAME_TOOL_SRC
:.c
=.o
)) \
134 $(DD
)version_install_name_tool.o
137 $(CC
) -Wall
-c
$(COPTS
) $(CINC
) -o
$@
$<
139 $(DD
)version_tease.o
: version.c
140 $(CC
) -Wall
-c
$(COPTS
) $(CINC
) -DPROGRAMNAME
=tease
-o
$@
$<
142 $(DD
)version_strip.o
: version.c
143 $(CC
) -Wall
-c
$(COPTS
) $(CINC
) -DPROGRAMNAME
=strip -o
$@
$<
145 $(DD
)version_install_name_tool.o
: version.c
146 $(CC
) -Wall
-c
$(COPTS
) $(CINC
) -DPROGRAMNAME
=install_name_tool
-o
$@
$<
148 $(DD
)tease
: $(TEASE_OBJS
)
149 $(CC
) -o
$@
$(LDOPTS
) $^
154 cd
'$(@D)' && zip
-X
-9 '$(@F)-$(CCTOOLSVER).zip' '$(@F)'
157 $(DD
)strip : $(STRIP_OBJS
)
158 $(CC
) -o
$@
$(LDOPTS
) $^
163 cd
'$(@D)' && zip
-X
-9 '$(@F)-$(CCTOOLSVER).zip' '$(@F)'
166 $(DD
)install_name_tool
: $(INSTALL_NAME_TOOL_OBJS
)
167 $(CC
) -o
$@
$(LDOPTS
) $^
172 cd
'$(@D)' && zip
-X
-9 '$(@F)-$(CCTOOLSVER).zip' '$(@F)'