-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
53 lines (41 loc) · 1.63 KB
/
Makefile.in
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
LIB_ROCKET_IO_SRC = $(filter-out src/main.c, $(wildcard src/*.c))
LIB_ROCKET_IO_OBJ = $(LIB_ROCKET_IO_SRC:.c=.o)
MAIN_SRC = src/main.c
MAIN_OBJ = $(MAIN_SRC:.c=.o)
ASM_SRC = $(wildcard src/arch/$(shell uname -m)/*.S)
ASM_OBJ = $(ASM_SRC:.S=.o)
LIBS = librocket_io.a
BINS = rocket_io_demo benchmark_file_io echo_server
LDFLAGS = -luring -lpthread -lrocket_io
INTERNAL_INCLUDES = -Iinclude_internal
PUBLIC_INCLUDES = -Iinclude
CFLAGS = $(DBG)
rocket_io_demo: $(MAIN_OBJ) $(LIBS)
clang $(CFLAGS) -o $@ $^ -L. $(LDFLAGS)
$(MAIN_OBJ): src/%.o : src/%.c
clang $(CFLAGS) $(PUBLIC_INCLUDES) -c -o $@ $<
$(LIB_ROCKET_IO_OBJ): src/%.o : src/%.c
clang $(CFLAGS) $(INTERNAL_INCLUDES) $(PUBLIC_INCLUDES) -c -o $@ $<
$(ASM_OBJ): src/%.o : src/%.S
clang $(CFLAGS) -c -o $@ $<
librocket_io.a: $(LIB_ROCKET_IO_OBJ) $(ASM_OBJ)
ar -rcs librocket_io.a $^
install: librocket_io.a
install -d $(DESTDIR)$(PREFIX)/lib/
install -m 644 librocket_io.a $(DESTDIR)$(PREFIX)/lib/
install -d $(DESTDIR)$(PREFIX)/include/rocket
install -m 644 include/rocket/*.h $(DESTDIR)$(PREFIX)/include/rocket
uninstall:
rm -rf $(DESTDIR)$(PREFIX)/include/rocket/
rm -f $(DESTDIR)$(PREFIX)/lib/librocket_io.a
BENCHMARK_SRC = $(wildcard src/benchmark/benchmark*.c)
BENCHMARK_OBJ = $(BENCHMARK_SRC:.c=.o)
$(BENCHMARK_OBJ): src/benchmark/%.o : src/benchmark/%.c
clang $(CFLAGS) $(PUBLIC_INCLUDES) -c -o $@ $<
benchmark_file_io: $(BENCHMARK_OBJ) $(LIBS)
clang $(CFLAGS) -o $@ $^ -L. $(LDFLAGS)
echo_server: src/benchmark/echo_server.c $(LIBS)
clang $(CFLAGS) $(PUBLIC_INCLUDES) $^ -o $@ -L. $(LDFLAGS)
.PHONY: clean
clean:
rm -f $(LIB_ROCKET_IO_OBJ) $(MAIN_OBJ) $(BENCHMARK_OBJ) $(BINS) $(LIBS)