-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (54 loc) · 1.77 KB
/
Copy pathMakefile
File metadata and controls
79 lines (54 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# The storage client library.
CLIENTLIB = libstorage.a
# The programs to build.
TARGETS = $(CLIENTLIB) server client encrypt_passwd benchmark
# The source files.
SRCS = server.c storage.c utils.c client.c encrypt_passwd.c benchmark.c
# Compile flags.
CFLAGS = -g -Wall
LDFLAGS = -g -Wall -lcrypt -lpthread
# Dependencies file
DEPEND_FILE = depend.mk
# ---------------------------------------------------------
# Targets to build the storage client and server.
# ---------------------------------------------------------
# Default targets.
build: $(TARGETS)
# Build the client library.
$(CLIENTLIB): storage.o utils.o
$(AR) rcs $@ $^
# Build the server.
server: server.o utils.o
$(CC) $(LDFLAGS) $^ -o $@
# Build the client.
client: client.o $(CLIENTLIB)
$(CC) $(LDFLAGS) $^ -o $@
# Build the password encryptor.
encrypt_passwd: encrypt_passwd.o utils.o
$(CC) $(LDFLAGS) $^ -o $@
# Build the benchmark tool.
benchmark: benchmark.o $(CLIENTLIB)
$(CC) $(LDFLAGS) $^ -o $@
# Compile a .c source file to a .o object file.
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Delete generated files.
clean:
-rm -rf $(TARGETS) *.o tags $(DEPEND_FILE)
# Create dependencies file.
depend:
$(CC) $(CFLAGS) -M $(SRCS) > $(DEPEND_FILE)
-include $(DEPEND_FILE)
# ---------------------------------------------------------
# Targets to help work with the code.
# ---------------------------------------------------------
# Create tags file to help with code navigation in some editors.
tags: *.c *.h
ctags -R .
# Create tags file including system header files.
fulltags: *.c *.h
ctags -R . `$(MAKE) -s print_include_dirs`
# Print the include directories for current system.
print_include_dirs:
@gcc -x c -Wp,-v -E - < /dev/null 2>&1 |grep '^ '
.PHONY: build depend clean tags fulltags print_include_dirs