1# 2# Common makefile fragment for ckutils. 3# This is -included from project-specific Makefiles, assumed 4# to be one directory down from this file. 5# 6# Standard binary locations. Assume LOCAL_BUILD_DIR in environment. 7# 8 9LOCAL_BUILD ?= $(shell echo $(LOCAL_BUILD_DIR)) 10ifeq "" "$(LOCAL_BUILD)" 11 LOCAL_BUILD = . 12endif 13 14CRYPTKIT_SRC= ../../lib 15 16OFILES= $(CSOURCE:%.c=%.o) $(CPPSOURCE:%.cpp=%.o) 17ALL_OFILES= $(OFILES) $(CRYPTKIT_LIB_BIN) 18 19# 20# override with recursive make for e.g. debug build 21# 22VARIANT_SUFFIX= 23 24# 25# override this with a recursive make to test minimal signature build 26# 27CRYPTKIT_CONFIG=-DCK_STANDALONE_BUILD 28 29# 30# override with recursive make to link against other binary 31# 32CRYPTKIT_BINARY=CryptKit 33 34# 35# Assume final load with cc, not ld 36# 37STD_LIBS= -l$(CRYPTKIT_BINARY)$(VARIANT_SUFFIX) 38STD_LIBPATH=-L$(LOCAL_BUILD) 39ALL_LIBS= $(STD_LIBS) $(PROJ_LIBS) 40ALL_LIBPATHS= $(STD_LIBPATH) $(PROJ_LIBPATH) 41 42# 43# Override this from the make command line to add e.g. -lMallocDebug 44# 45CMDLINE_LDFLAGS= 46 47STD_FRAMEWORKS= 48STD_FRAME_PATH= -F$(LOCAL_BUILD) -F/usr/local/SecurityPieces/Frameworks 49 50# 51ALL_LDFLAGS= $(CMDLINE_LDFLAGS) $(ALL_LIBS) $(ALL_LIBPATHS) $(STD_FRAME_PATH) $(PROJ_LDFLAGS) 52 53CC= /usr/bin/gcc 54 55ALL_FRAMEWORKS= $(STD_FRAMEWORKS) $(PROJ_FRAMEWORKS) 56 57# CryptKit headers accessed via <CryptKit/foo.h> 58STD_INCLUDES= -I$(CRYPTKIT_SRC) -I.. 59ALL_INCLUDES= $(STD_INCLUDES) $(PROJ_INCLUDES) 60CINCLUDES= $(ALL_INCLUDES) 61 62WFLAGS= -Wno-four-char-constants -Wall -Werror -Wno-format -Wno-deprecated-declarations 63STD_CFLAGS= -g $(VERBOSE) $(CRYPTKIT_CONFIG) 64 65ALL_CFLAGS= $(CINCLUDES) $(STD_CFLAGS) $(PROJ_CFLAGS) $(WFLAGS) $(STD_FRAME_PATH) 66 67BUILT_TARGET= $(EXECUTABLE) 68 69first: $(BUILT_TARGET) 70 71debug: 72 echo making debug 73 make "VARIANT_SUFFIX=_debug" 74 75smallsig: 76 make "CRYPTKIT_CONFIG=-DCK_MINIMUM_SIG_BUILD" "CRYPTKIT_BINARY=CryptKitSignature" 77 78clean: 79 rm -f $(OFILES) $(EXECUTABLE) $(OTHER_TO_CLEAN) 80 81$(BUILT_TARGET): $(ALL_OFILES) $(PROJ_DEPENDS) 82 cc -o $(BUILT_TARGET) $(ALL_OFILES) $(ALL_FRAMEWORKS) $(ALL_LDFLAGS) 83 84.c.o: 85 $(CC) $(ALL_CFLAGS) -c -o $*.o $< 86 87.cpp.o: 88 $(CC) $(ALL_CFLAGS) -c -o $*.o $< 89