]>
Commit | Line | Data |
---|---|---|
b1ab9ed8 A |
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 | ||
9 | LOCAL_BUILD ?= $(shell echo $(LOCAL_BUILD_DIR)) | |
10 | ifeq "" "$(LOCAL_BUILD)" | |
11 | LOCAL_BUILD = . | |
12 | endif | |
13 | ||
14 | CRYPTKIT_SRC= ../../lib | |
15 | ||
16 | OFILES= $(CSOURCE:%.c=%.o) $(CPPSOURCE:%.cpp=%.o) | |
17 | ALL_OFILES= $(OFILES) $(CRYPTKIT_LIB_BIN) | |
18 | ||
19 | # | |
20 | # override with recursive make for e.g. debug build | |
21 | # | |
22 | VARIANT_SUFFIX= | |
23 | ||
24 | # | |
25 | # override this with a recursive make to test minimal signature build | |
26 | # | |
27 | CRYPTKIT_CONFIG=-DCK_STANDALONE_BUILD | |
28 | ||
29 | # | |
30 | # override with recursive make to link against other binary | |
31 | # | |
32 | CRYPTKIT_BINARY=CryptKit | |
33 | ||
34 | # | |
35 | # Assume final load with cc, not ld | |
36 | # | |
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) | |
41 | ||
42 | # | |
43 | # Override this from the make command line to add e.g. -lMallocDebug | |
44 | # | |
45 | CMDLINE_LDFLAGS= | |
46 | ||
47 | STD_FRAMEWORKS= | |
48 | STD_FRAME_PATH= -F$(LOCAL_BUILD) -F/usr/local/SecurityPieces/Frameworks | |
49 | ||
50 | # | |
51 | ALL_LDFLAGS= $(CMDLINE_LDFLAGS) $(ALL_LIBS) $(ALL_LIBPATHS) $(STD_FRAME_PATH) $(PROJ_LDFLAGS) | |
52 | ||
53 | CC= /usr/bin/gcc | |
54 | ||
55 | ALL_FRAMEWORKS= $(STD_FRAMEWORKS) $(PROJ_FRAMEWORKS) | |
56 | ||
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) | |
61 | ||
62 | WFLAGS= -Wno-four-char-constants -Wall -Werror -Wno-format -Wno-deprecated-declarations | |
63 | STD_CFLAGS= -g $(VERBOSE) $(CRYPTKIT_CONFIG) | |
64 | ||
65 | ALL_CFLAGS= $(CINCLUDES) $(STD_CFLAGS) $(PROJ_CFLAGS) $(WFLAGS) $(STD_FRAME_PATH) | |
66 | ||
67 | BUILT_TARGET= $(EXECUTABLE) | |
68 | ||
69 | first: $(BUILT_TARGET) | |
70 | ||
71 | debug: | |
72 | echo making debug | |
73 | make "VARIANT_SUFFIX=_debug" | |
74 | ||
75 | smallsig: | |
76 | make "CRYPTKIT_CONFIG=-DCK_MINIMUM_SIG_BUILD" "CRYPTKIT_BINARY=CryptKitSignature" | |
77 | ||
78 | clean: | |
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 $< |