-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (31 loc) · 1.03 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
CC = g++
CFLAGS = -g -Wall -fPIC #-pthread
#CFLAGS = -O2 -Wall -fPIC -pthread
LDFLAGS = -fPIC -pthread
DEFINES = -D_REENTRANT
INC_PATH = $(GTEST_DIR)/include
OBJ_DIR = .
GTEST_LIB = -lgtest_main -L$(GTEST_DIR)/lib
LDLIBS = $(GTEST_LIB)
TARGET_LIB = libhstring.a
TARGET_APP =
TEST_APP = hstring_test
%.o: %.c
$(CC) -c $(CFLAGS) $(DEFINES) $(INC_PATH:%=-I%) $< -o $(OBJ_DIR)/$@
%.o: %.cc
$(CC) -c $(CFLAGS) $(DEFINES) $(INC_PATH:%=-I%) $< -o $(OBJ_DIR)/$@
%.o: %.cpp
$(CC) -c $(CFLAGS) $(DEFINES) $(INC_PATH:%=-I%) $< -o $(OBJ_DIR)/$@
all: $(TARGET_APP) $(TARGET_LIB) $(TEST_APP)
libhstring.a: hstring.o astring.o
ar rcv $@ $(addprefix $(OBJ_DIR)/,$(notdir $(filter %.o,$^))) $(filter-out %.o,$^)
ranlib $@
hstring_test: hstring_test.o -lhstring
$(CC) -o $@ $(addprefix $(OBJ_DIR)/,$(notdir $(filter %.o,$^))) $(filter-out %.o,$^) $(LDFLAGS) $(LDLIBS)
clean:
$(RM) $(TARGET_LIB) $(TARGET_APP) $(TEST_APP) $(OBJ_DIR)/*.o
tag:
ctags -B --C++-kinds=+l -R .
dep:
$(CC) -MM $(CFLAGS) $(DEFINES) *.c *.cc *.cpp > .depend
-include .depend