-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
35 lines (24 loc) · 1011 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
CC := gcc
CXX := g++
CFLAGS := -std=c99 -Wall -Wextra -fPIC
CXXFLAGS := -std=c++11 -Wall -Wextra
# wasn't working for me LDFLAGS := ""
OBJS = iptree.o
all: gtest test_gtest shared_lib static_lib test_standalone
gtest: libgtest_main.a
libgtest_main.a: gtest/src/*.h gtest/src/*.cc gtest/include/gtest/*.h gtest/include/gtest/internal/*h
g++ $(CXXFLAGS) -Igtest -Igtest/include gtest/src/gtest-all.cc gtest/src/gtest_main.cc -c
ar -rv $@ gtest-all.o gtest_main.o
test_gtest: $(OBJS) gtest test_iptree.cc
g++ $(CXXFLAGS) $(OBJS) -pthread -Igtest/include test_iptree.cc libgtest_main.a -o $@
shared_lib: $(OBJS)
gcc $(CFLAGS) -shared $(LDFLAGS) $(OBJS) -o libiptree.so
static_lib: $(OBJS)
ar -rv libiptree.a $(OBJS)
test_standalone: $(objs)
gcc $(CFLAGS) -g test.c $(OBJS) -o $@
test_big: $(objs)
g++ $(CXXFLAGS) -I jsoncpp -I jsoncpp/include -g bigTest.cc $(OBJS) -L jsoncpp/build/debug/src/lib_json -l jsoncpp -o $@
.PHONY: clean
clean:
rm -f *.o *.a *.so test_gtest test_standalone test_big