-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile1
56 lines (43 loc) · 1.17 KB
/
Makefile1
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
TARGET = Assignment1
DEPENDENDENT_DIRS = Image Util
SOURCE = main1.cpp
CFLAGS += -I. -I.. -std=c++14 -Wunused-result
LFLAGS += -L. -lUtil -lImage -ljpeg
CFLAGS_DEBUG = -DDEBUG -g3
LFLAGS_DEBUG =
CFLAGS_RELEASE = -O3 -DRELEASE -funroll-loops -ffast-math -DNDEBUG
LFLAGS_RELEASE = -O3
SRC = ./
BIN = ./
BIN_O = ./Bin/Linux/Release/$(TARGET)/
INCLUDE = /usr/include/
CC = gcc
CXX = g++
MD = mkdir
AR = ar
OBJECTS=$(addprefix $(BIN_O), $(addsuffix .o, $(basename $(SOURCE))))
all: CFLAGS += $(CFLAGS_RELEASE)
all: LFLAGS += $(LFLAGS_RELEASE)
all: $(BIN)
all: $(BIN_O)
all: $(BIN)$(TARGET)
debug: CFLAGS += $(CFLAGS_DEBUG)
debug: LFLAGS += $(LFLAGS_DEBUG)
debug: $(BIN)
debug: $(BIN_O)
debug: $(BIN)$(TARGET)
clean:
rm -f $(BIN)$(TARGET)
rm -f $(OBJECTS)
for dir in $(DEPENDENDENT_DIRS); do make clean -C $$dir; done
$(BIN):
$(MD) -p $(BIN)
$(BIN_O):
$(MD) -p $(BIN_O)
$(BIN)$(TARGET): $(OBJECTS)
for dir in $(DEPENDENDENT_DIRS); do make -C $$dir; done
$(CXX) -o $@ $(OBJECTS) $(LFLAGS)
$(BIN_O)%.o: $(SRC)%.c
$(CC) -c -o $@ $(CFLAGS) -I$(INCLUDE) $<
$(BIN_O)%.o: $(SRC)%.cpp
$(CXX) -c -o $@ $(CFLAGS) -I$(INCLUDE) $<