forked from hariguchi/art
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
81 lines (58 loc) · 1.41 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
CC := gcc
PERL := perl
PROF := #-pg
# Flags
OPTFLAGS := -O0
DEFS += -DDEBUG_FREE_HEAP
CFLAGS := -Wall -g $(PROF) $(OPTFLAGS) $(DEFS)
LDFLAGS :=
# Libraries
LDLIBS :=
LOADLIBES :=
# Target names
TARGET := rtLookup
LIBTARGET := libipart.a
# Directories to build
OBJDIR := obj/
DEPDIR := dep/
# Source files
LIBSRCS4 :=
SRCS4 :=
LIBSRCS6 := ipArt.c ipArtPathComp.c
SRCS6 := lkupTest.c #util.c
LIBSRCS := $(LIBSRCS6)
SRCS := $(SRCS6)
# Object files
LIBOBJS := $(addprefix $(OBJDIR),$(LIBSRCS:.c=.o))
OBJS := $(addprefix $(OBJDIR),$(SRCS:.c=.o))
$(TARGET): $(OBJS) $(LIBTARGET)
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) $(PROF) -o $@
$(LIBTARGET): $(LIBOBJS)
$(AR) $(ARFLAGS) $@ $^
ranlib $@
.PHONY: release
release:
$(MAKE) DEFS='-DOPTIMIZATION_ON -DNDEBUG' OPTFLAGS=-O3
.PHONY: test
test:
$(MAKE) clean
$(MAKE) release
./tests.sh
.PHONY: prof
prof:
$(MAKE) DEFS=-DOPTIMIZATION_ON OPTFLAGS=-O3 PROF=-pg
.PHONY: clean
clean:
rm -f $(TARGET) $(LIBTARGET) $(OBJS) $(LIBOBJS) *.bak *~
# Include dependency files
include $(addprefix $(DEPDIR),$(SRCS:.c=.d))
$(DEPDIR)%.d : %.c
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< | sed "s@$*.o@& $@@g " > $@'
$(OBJDIR)%.o: %.c $(DEPDIR)%.d
$(COMPILE.c) $(OUTPUT_OPTION) $<
$(OBJDIR)%.o: %.cc $(DEPDIR)%.d
$(COMPILE.cc) $(OUTPUT_OPTION) $<
$(OBJDIR)%.o: %.cpp $(DEPDIR)%.d
$(COMPILE.cc) $(OUTPUT_OPTION) $<
%.i : %.c
$(CC) -E $(CPPFLAGS) $<