-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
32 lines (24 loc) · 871 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
COMMON_DIR := ./common
COMMON_SRC := $(wildcard $(COMMON_DIR)/*.c) $(wildcard $(COMMON_DIR)/*.cpp)
COMMON_OBJ := $(patsubst $(COMMON_DIR)/%,%.o,$(COMMON_SRC))
override CFLAGS += -g -I./include -D PRINTF # -D T_RAND -D P_RAND
override LIBS += -lssl -lcrypto -lrt -lstdc++ -lstdc++fs -lpthread -lprofiler -lxxhash -lz -lm
all: libmcfs
install: libmcfs
sudo mkdir -p /usr/local/include/mcfs
sudo cp include/*.h /usr/local/include/mcfs/
sudo cp $^.so /usr/local/lib/
sudo ldconfig
uninstall: libmcfs
sudo rm -rf /usr/local/include/mcfs
sudo rm /usr/local/lib/$^.so
sudo ldconfig
libmcfs: $(COMMON_OBJ)
ar rvs $@.a $^
gcc -shared -fPIC -o $@.so $^ $(LIBS)
%.c.o: $(COMMON_DIR)/%.c
gcc -Wall -Werror -o $@ -fPIC -c $< $(CFLAGS) $(LIBS)
%.cpp.o: $(COMMON_DIR)/%.cpp
g++ -std=c++11 -Wall -Werror -o $@ -fPIC -c $< $(CFLAGS) $(LIBS)
clean:
rm -f *.o *.so *.a