2 # Common makefile fragment for ckutils.
3 # This is -included from project-specific Makefiles, assumed
4 # to be one directory down from this file.
6 # Standard binary locations. Assume LOCAL_BUILD_DIR in environment.
9 LOCAL_BUILD ?= $(shell echo $(LOCAL_BUILD_DIR))
10 ifeq "" "$(LOCAL_BUILD)"
14 CRYPTKIT_SRC= ../../lib
16 OFILES= $(CSOURCE:%.c=%.o) $(CPPSOURCE:%.cpp=%.o)
17 ALL_OFILES= $(OFILES) $(CRYPTKIT_LIB_BIN)
20 # override with recursive make for e.g. debug build
25 # override this with a recursive make to test minimal signature build
27 CRYPTKIT_CONFIG=-DCK_STANDALONE_BUILD
30 # override with recursive make to link against other binary
32 CRYPTKIT_BINARY=CryptKit
35 # Assume final load with cc, not ld
37 STD_LIBS= -l$(CRYPTKIT_BINARY)$(VARIANT_SUFFIX)
38 STD_LIBPATH=-L$(LOCAL_BUILD)
39 ALL_LIBS= $(STD_LIBS) $(PROJ_LIBS)
40 ALL_LIBPATHS= $(STD_LIBPATH) $(PROJ_LIBPATH)
43 # Override this from the make command line to add e.g. -lMallocDebug
48 STD_FRAME_PATH= -F$(LOCAL_BUILD) -F/usr/local/SecurityPieces/Frameworks
51 ALL_LDFLAGS= $(CMDLINE_LDFLAGS) $(ALL_LIBS) $(ALL_LIBPATHS) $(STD_FRAME_PATH) $(PROJ_LDFLAGS)
55 ALL_FRAMEWORKS= $(STD_FRAMEWORKS) $(PROJ_FRAMEWORKS)
57 # CryptKit headers accessed via <CryptKit/foo.h>
58 STD_INCLUDES= -I$(CRYPTKIT_SRC) -I..
59 ALL_INCLUDES= $(STD_INCLUDES) $(PROJ_INCLUDES)
60 CINCLUDES= $(ALL_INCLUDES)
62 WFLAGS= -Wno-four-char-constants -Wall -Werror -Wno-format -Wno-deprecated-declarations
63 STD_CFLAGS= -g $(VERBOSE) $(CRYPTKIT_CONFIG)
65 ALL_CFLAGS= $(CINCLUDES) $(STD_CFLAGS) $(PROJ_CFLAGS) $(WFLAGS) $(STD_FRAME_PATH)
67 BUILT_TARGET= $(EXECUTABLE)
69 first: $(BUILT_TARGET)
73 make "VARIANT_SUFFIX=_debug"
76 make "CRYPTKIT_CONFIG=-DCK_MINIMUM_SIG_BUILD" "CRYPTKIT_BINARY=CryptKitSignature"
79 rm -f $(OFILES) $(EXECUTABLE) $(OTHER_TO_CLEAN)
81 $(BUILT_TARGET): $(ALL_OFILES) $(PROJ_DEPENDS)
82 cc -o $(BUILT_TARGET) $(ALL_OFILES) $(ALL_FRAMEWORKS) $(ALL_LDFLAGS)
85 $(CC) $(ALL_CFLAGS) -c -o $*.o $<
88 $(CC) $(ALL_CFLAGS) -c -o $*.o $<