-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (43 loc) · 1.3 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
export CC = gcc
export CXX = g++
export CFLAGS = -Wall
export CXXFLAGS = -Wall
DIRS = $(shell ls -F | grep /)
DIRSALL = $(DIRS:%/=%all)
DIRSCLEAN = $(DIRS:%/=%clean)
CSRCS = $(wildcard *.c)
COBJS = $(CSRCS:%.c=%.o)
CPPSRCS = $(wildcard *.cpp)
CPPOBJS = $(CPPSRCS:%.cpp=%.o)
CURL = -L/usr/lib/x86_64-linux-gnu -lcurl
JSONCFLAGS = -I/usr/local/include/json
JSONLDFLAGS = -L/usr/local/lib -ljson
EKHTML = /usr/local/lib/libekhtml.a
MYSQLCFLAGS = -I/usr/local/mysql/include/mysql -I/usr/include/mysql
MYSQLLDFLAGS = -L/usr/local/mysql/lib/mysql -L/usr/lib/mysql -lmysqlclient
LDFLAGS = $(CURL)
OBJS = $(COBJS) $(CPPOBJS)
SRCS = $(CSRCS) $(CPPSRCS)
CALL = $(basename $(CSRCS))
CPPALL = $(basename $(CPPSRCS))
ALL = $(CALL) $(CPPALL)
.PHONY: all clean $(DIRSALL) $(DIRSCLEAN)
all: $(DIRSALL) $(ALL)
ekhtml_tester ekhtml_parse_hdu: LDFLAGS = $(CURL) $(EKHTML)
function_test: LDFLAGS = $(CURL) $(EKHTML) $(MYSQLLDFLAGS)
json_test: CFLAGS = $(JSONCFLAGS)
json_test: LDFLAGS = $(JSONLDFLAGS)
$(CALL): %: %.o
$(CC) $(CFLAGS) -o $@ $@.o $(LDFLAGS)
$(CPPALL): %: %.o
$(CXX) $(CFLAGS) -o $@ $@.o $(LDFLAGS)
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) -c $<
$(CPPOBJS): %.o: %.cpp
$(CXX) $(CFLAGS) -c $<
$(DIRSALL): %:
@cd $(subst all,,$@); make all;
$(DIRSCLEAN): %:
@cd $(subst clean,,$@); make clean;
clean: $(DIRSCLEAN)
$(RM) $(OBJS) $(ALL)