-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (38 loc) · 924 Bytes
/
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
53
54
55
CC=gcc
CFLAGS+=-std=c99 -Wall -I. -L. -O3
LIBNAME = libhmap.a
LIBDEPS = duration.h xalloc.h hmap.h
LIBOBJ = hmap.o
OBJ1 = hmap.o hmap_test.o
OBJ2 = hmap.o hmap_example.o
OBJ1_DEPLIBS = -lrt
OBJ2_DEPLIBS =
%.o: %.c $(LIBDEPS)
$(CC) -c -o $@ $< $(CFLAGS)
all: $(LIBNAME) hmap_test hmap_example
$(LIBNAME): $(LIBOBJ)
ar rc $@ $^
ranlib $@
hmap_test: $(OBJ1)
$(CC) -o $@ $^ $(OBJ1_DEPLIBS) $(CFLAGS)
hmap_example: $(OBJ2)
$(CC) -o $@ $^ $(OBJ2_DEPLIBS) $(CFLAGS)
.PHONY: fast
fast:
$(MAKE) -j8 $(LIBNAME)
$(MAKE) -j8 all
.PHONY: clean
clean:
rm -rf *.o *~ core hmap_test hmap_example $(LIBNAME)
remake: clean all
refast: clean fast
reprof: clean prof
prof: CFLAGS += -pg -Winline -Wpedantic
prof: all
debug: CFLAGS += -g -Winline -Wpedantic
debug: all
debugfast: CFLAGS += -g -Winline -Wpedantic
debugfast: fast
redebug: clean debug
redebugfast: CFLAGS += -g -Winline -Wpedantic
redebugfast: clean fast