]> git.saurik.com Git - apple/security.git/blame - SecurityTests/clxutils/Makefile.lib
Security-57337.20.44.tar.gz
[apple/security.git] / SecurityTests / clxutils / Makefile.lib
CommitLineData
d8f41ccd
A
1#
2# Common makefile fragment for dmitch's SecurityX-style clxutils,
3# tailored for building a library.
4# This is -included from project-specific Makefiles, assumed
5# to be one directory down from this file.
6#
7# See Makefile.template for sample project-specific Makefile.
8#
9
10# Defaults for variables provided by buildit
11#
12# Object files written to '.' unless OBJROOT specified
13#
14OBJROOT ?= .
15SRCROOT ?= .
16#
17# Library written to SYMROOT if specified, else to LOCAL_BUILD_DIR
18# env var if specified, else to '.'.
19#
20SYMROOT ?= $(shell echo $(LOCAL_BUILD_DIR))
21LOCAL_BUILD=$(SYMROOT)
22ifeq "" "$(LOCAL_BUILD)"
23 LOCAL_BUILD = .
24endif
25
26# independent of SYMROOT
27CLEAN_DIR=$(shell echo $(LOCAL_BUILD_DIR))
28ifeq "" "$(CLEAN_DIR)"
29 CLEAN_DIR = .
30endif
31
32#
33# DSTROOT only used for install
34#
35DSTROOT ?= ""
36
37# if DSTROOT not specified, skip the extra -I to get to cspxutils headers
38ifeq ("", $(DSTROOT))
39 UTILLIB_HDRS=
40else
41 UTILLIB_HDRS="-I$(DSTROOT)/usr/local/include"
42endif
43
44INSTALLDIR := $(DSTROOT)/usr/local/lib
45
46CC=c++
47
48COMMON_LIB_SRC= -I../../cspxutils/
49
50OFILES := $(CSOURCE:%.c=$(OBJROOT)/%.o) $(CPSOURCE:%.cpp=$(OBJROOT)/%.o)
51
52PRIV_FRAMEWORK_PATH= /System/Library/PrivateFrameworks
53
54ALL_LDFLAGS= -static $(PROJ_LDFLAGS)
55
56STD_FRAMEWORKS=
57ALL_FRAMEWORKS= $(STD_FRAMEWORKS) $(PROJ_FRAMEWORKS)
58
59#
60# to get to headers in frameworks
61#
62STD_FINCLUDES= -F$(LOCAL_BUILD) -F/System/Library/Frameworks/CoreServices.framework/Frameworks
63STD_INCLUDES= -I.. $(COMMON_LIB_SRC) $(UTILLIB_HDRS) -F$(PRIV_FRAMEWORK_PATH)
64
65ALL_INCLUDES= $(STD_INCLUDES) $(PROJ_INCLUDES)
66CINCLUDES= $(STD_FINCLUDES) $(ALL_INCLUDES)
67
68###WFLAGS= -Wno-four-char-constants -Wall -Werror
69WFLAGS= -Wno-four-char-constants -Wall -Wno-deprecated-declarations
70STD_CFLAGS= -g $(VERBOSE)
71DEBUG_CFLAGS?=
72
73ALL_CFLAGS= $(CINCLUDES) $(STD_CFLAGS) $(PROJ_CFLAGS) $(WFLAGS) $(DEBUG_CFLAGS)
74
75#
76# Executable has to be in build folder for MDS
77#
78BUILT_TARGET= $(LOCAL_BUILD)/$(EXECUTABLE)
79
80first: $(PROJ_DEPENDS) $(BUILT_TARGET)
81
82build: first
83
84# architecture options
85
8664bit:
87 make "DEBUG_CFLAGS=-arch x86_64"
88
8964bitFat:
90 make "DEBUG_CFLAGS=-arch x86_64 -arch i386"
91
92fat:
93 make "DEBUG_CFLAGS=-arch i386" "CMDLINE_LDFLAGS=-arch i386"
94
95install: build
96 install -d -m 0755 $(INSTALLDIR)
97 install -p -m 0644 $(BUILT_TARGET) $(INSTALLDIR)
98
99installhdrs:
100
101$(BUILT_TARGET): $(OFILES)
102 libtool $(ALL_LDFLAGS) -o $(BUILT_TARGET) $^
103
104clean:
105 cd $(SRCROOT); rm -f $(OFILES) *.o
106 rm -f $(BUILT_TARGET)
107 rm -f $(CLEAN_DIR)/$(EXECUTABLE)
108
109$(OBJROOT)/%.o: %.c
110 $(CC) $(ALL_CFLAGS) -c -o $(OBJROOT)/$*.o $<
111
112$(OBJROOT)/%.o: %.cpp
113 $(CC) $(ALL_CFLAGS) -c -o $(OBJROOT)/$*.o $<