-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (36 loc) · 1 KB
/
Makefile
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
CC=gcc
CFLAGS+=-std=c99 -Wall -I. -O3
LIBNAME = libbarser.a
LIBDEPS = rbt/fq.h rbt/st.h rbt/st_inline.h rbt/rbt.h xxh.h itoa.h linked_list.h barser_index.h barser.h barser_defaults.h
LIBOBJ = rbt/fq.o rbt/st.o rbt/rbt.o itoa.o linked_list.o xxh.o barser_index_rbt.o barser.o
OBJ1 = barser_test.o
OBJ2 = barser_example.o
OBJ1_DEPLIBS = -lrt
OBJ2_DEPLIBS =
%.o: %.c $(LIBDEPS)
$(CC) -c -o $@ $< $(CFLAGS)
all: $(LIBNAME) barser_test barser_example
$(LIBNAME): $(LIBOBJ)
ar rc $@ $^
ranlib $@
barser_test: $(OBJ1) $(LIBNAME)
$(CC) -o $@ $^ $(OBJ1_DEPLIBS) $(CFLAGS)
barser_example: $(OBJ2) $(LIBNAME)
$(CC) -o $@ $^ $(OBJ2_DEPLIBS) $(CFLAGS)
.PHONY: fast
fast:
$(MAKE) -j8 $(LIBNAME)
$(MAKE) -j8 all
.PHONY: clean
clean:
rm -rf *.o *~ core barser_test barser_example rbt/*.o $(LIBNAME)
remake: clean all
refast: clean fast
colldebug: CFLAGS += -DCOLL_DEBUG
colldebug: all
recolldebug: CFLAGS += -DCOLL_DEBUG
recolldebug: clean all
debug: CFLAGS += -g
debug: all
redebug: CFLAGS += -g
redebug: clean all