-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (27 loc) · 753 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
TARGET = run
SOURCES = Test4 IRProviderConst
EXTLIBS =
CXXFLAGS += -MP -MMD -fPIC
CXXFLAGS += -std=c++17
CXXFLAGS += -O0 -g
#LDFLAGS += -fPIC
#LDFLAGS += -pthread
#LDFLAGS += -Wl,--as-needed
#LDFLAGS += -Wl,--no-undefined
BUILD_DIR = $(shell pwd)
OBJECTS_DIR = $(BUILD_DIR)/obj
OBJECTS = $(patsubst %, $(OBJECTS_DIR)/%.o, $(SOURCES))
all: $(TARGET)
$(OBJECTS_DIR):
$(shell mkdir -p $(OBJECTS_DIR))
$(OBJECTS_DIR)/%.o: %.cpp
@echo [CXX] $(@F)
$(CXX) $(CXXFLAGS) -o $@ -c $(realpath $<)
$(OBJECTS_DIR)/%.o: %.c
@echo [CC] $(@F)
$(CC) $(CFLAGS) -o $@ -c $(realpath $<)
$(TARGET) : $(OBJECTS_DIR) $(OBJECTS)
$(CXX) $(LDFLAGS) -o $(TARGET) $(OBJECTS) '-Wl,-(' $(EXTLIBS)
clean:
$(shell rm -fr $(OBJECTS_DIR))
$(shell rm -f $(TARGET))