]> git.saurik.com Git - apple/copyfile.git/blob - Makefile
copyfile-42.tar.gz
[apple/copyfile.git] / Makefile
1 ##
2 # Makefile for copyfile
3 ##
4 # Project info
5
6 Project = copyfile
7 #Extra_CC_Flags =
8
9 #lazy_install_source:: shadow_source
10
11 include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make
12
13 SRCROOT ?= .
14 OBJROOT ?= .
15 SYMROOT ?= .
16 DSTROOT ?= .
17
18 LIB_DIR = $(DSTROOT)/usr/local/lib/system
19 MAN_DIR = $(DSTROOT)/usr/share/man/man3
20 INC_DIR = $(DSTROOT)/usr/include
21
22 WFLAGS= -Wno-trigraphs -Wmissing-prototypes -Wreturn-type -Wformat \
23 -Wmissing-braces -Wparentheses -Wswitch -Wunused-function \
24 -Wunused-label -Wunused-variable -Wunused-value -Wshadow \
25 -Wsign-compare -Wall -Wextra -Wpointer-arith -Wreturn-type \
26 -Wwrite-strings -Wcast-align -Wbad-function-cast \
27 -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls \
28 -Wno-parentheses -Wformat=2 -Wimplicit-function-declaration \
29 -Wshorten-64-to-32 -Wformat-security
30
31 CFLAGS += -D__DARWIN_NON_CANCELABLE=1 $(WFLAGS)
32 SRC = copyfile.c
33 VERSOBJ= $(OBJROOT)/__version.o
34 OBJ = $(SRC:.c=.o)
35 HDRS= copyfile.h
36 LIBS = $(SYMROOT)/libcopyfile.a $(SYMROOT)/libcopyfile_profile.a $(SYMROOT)/libcopyfile_debug.a
37
38 installhdrs:: $(HDRS)
39 install -d -m 755 $(INC_DIR)
40 install -c -m 444 $(SRCROOT)/copyfile.h $(INC_DIR)
41
42 install:: $(LIBS)
43 install -d -m 755 $(MAN_DIR)
44 install -c -m 644 $(SRCROOT)/copyfile.3 $(MAN_DIR)
45 for a in fcopyfile copyfile_state_alloc copyfile_state_free \
46 copyfile_state_get copyfile_state_set ; do \
47 ln $(MAN_DIR)/copyfile.3 $(MAN_DIR)/$$a.3 ; \
48 done
49 install -d -m 755 $(LIB_DIR)
50 install -c -m 644 $(LIBS) $(LIB_DIR)
51 install -d -m 755 $(INC_DIR)
52 install -c -m 444 $(SRCROOT)/copyfile.h $(INC_DIR)
53
54 $(OBJROOT)/__version.c:
55 /Developer/Makefiles/bin/version.pl $(Project) > $@
56
57 $(VERSOBJ): $(OBJROOT)/__version.c
58 $(CC) -c -Os $(CFLAGS) $(RC_CFLAGS) -o $@ $^
59
60 $(OBJROOT)/%.o: $(SRCROOT)/%.c
61 $(CC) -c -Os $(CFLAGS) $(RC_CFLAGS) -o $@ $^
62
63 $(OBJROOT)/%-profile.o: $(SRCROOT)/%.c
64 $(CC) -c -pg $(CFLAGS) $(RC_CFLAGS) -o $@ $^
65
66 $(OBJROOT)/%-debug.o: $(SRCROOT)/%.c
67 $(CC) -c -g $(CFLAGS) $(RC_CFLAGS) -o $@ $^
68
69 $(SYMROOT)/libcopyfile.a:: $(OBJROOT)/$(OBJ) $(VERSOBJ)
70 libtool -static -o $@ $^
71
72 $(SYMROOT)/libcopyfile_profile.a:: $(OBJROOT)/copyfile-profile.o $(VERSOBJ)
73 libtool -static -o $@ $^
74
75 $(SYMROOT)/libcopyfile.a:: $(OBJROOT)/$(OBJ) $(VERSOBJ)
76 libtool -static -o $@ $^
77
78 $(SYMROOT)/libcopyfile_debug.a:: $(OBJROOT)/copyfile-debug.o $(VERSOBJ)
79 libtool -static -o $@ $^