forked from acozzette/BUSE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (30 loc) · 970 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
BIN := bin
TARGET := $(BIN)/buseMainTest
TEST := $(BIN)/test
LIBOBJS := $(BIN)/buse.o $(BIN)/buseOperations.o $(BIN)/buseRAMDevice.o $(BIN)/buseLODevice.o $(BIN)/diskStats.o
OBJS := $(TARGET:=.o) $(LIBOBJS)
STATIC_LIB := $(BIN)/libbuse.a
COMMONHEADERS := commonIncludes.h buse.h
CC := /usr/bin/g++
CFLAGS := -pedantic -Wall -Wextra -std=c++14
LDFLAGS := -Lbin -lbuse -lboost_system -lrt
.PHONY: all clean
all: $(BIN) $(TARGET) $(TEST)
debug: CFLAGS += -DDEBUG -g
debug: $(BIN) $(TARGET) $(TEST)
${BIN}:
mkdir -p ${BIN}
$(TEST): %: %.o
$(CC) -o $@ $<
$(TEST:=.o): $(BIN)/%.o: %.cpp
$(CC) $(CFLAGS) -o $@ -c $<
$(TARGET): %: %.o $(STATIC_LIB)
$(CC) -o $@ $< $(LDFLAGS)
$(TARGET:=.o): $(BIN)/%.o: %.cpp $(COMMONHEADERS)
$(CC) $(CFLAGS) -o $@ -c $<
$(STATIC_LIB): $(LIBOBJS)
ar rcu $(STATIC_LIB) $(LIBOBJS)
$(LIBOBJS): $(BIN)/%.o: %.cpp $(COMMONHEADERS)
$(CC) $(CFLAGS) -o $@ -c $<
clean:
rm -f $(TARGET) $(OBJS) $(STATIC_LIB)