forked from swordflychen/libconhash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (43 loc) · 854 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
56
57
58
#
# date: 2015-04-17
#
# output path
BIN = ./bin
SRC = ./src
# debug stuff
ifeq ($(CFLAG), DEBUG)
CFLAGS += -g
endif
AR = ar -cqs
# itermidiate objects
OBJ = $(addprefix $(BIN)/, \
md5.o \
util_rbtree.o \
conhash_inter.o \
conhash_util.o \
conhash.o \
)
SAMPLE_OBJS = $(addprefix $(BIN)/, \
sample.o \
)
# include file path
INC = -I$(SRC)
TARGETS = $(BIN)/libconhash.a $(BIN)/sample
all: clean prepare $(TARGETS)
# build libconhash as a static lib
$(BIN)/libconhash.a: $(OBJ)
$(AR) $@ $(OBJ)
# build sample
$(BIN)/sample: $(SAMPLE_OBJS)
gcc -O -o $@ $(SAMPLE_OBJS) -L. -L$(BIN) -lconhash
$(BIN)/%.o: $(SRC)/%.c
gcc $(INC) $(CFLAGS) -c $< -o $@
# prepare the bin dir
prepare:
-mkdir $(BIN)
clean:
-rm -rf $(BIN)
# git commands alias
push:
git push -u origin master
.PHONY: all prepare clean