-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommon.mk
49 lines (38 loc) · 900 Bytes
/
common.mk
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
ifeq ($(VERBOSE),1)
ECHO :=
else
ECHO := @
endif
# Compilation flags
ifeq ($(DEBUG),1)
CXXFLAGS += -g
else
CXXFLAGS += -O2
endif
# Compiler
CXX ?= g++
# Target
TARGET := mandelbrot
TARGET_DIR := bin
EXTLIBS_DIR ?= ./extlibs
# Directories
INC_DIRS := . $(EXTLIBS_DIR)/inc
LIB_DIRS := $(EXTLIBS_DIR)/lib
# Files
INCS := $(wildcard *.h)
SRCS := $(wildcard *.cpp)
LIBS := SDL2
# Make it all!
all : $(TARGET_DIR)/$(TARGET) $(OTHER_TARGETS)
# Host executable target.
$(TARGET_DIR)/$(TARGET) : common.mk $(MK_SRCS) $(SRCS) $(INCS)
@[ -d $(TARGET_DIR) ] || mkdir $(TARGET_DIR)
$(ECHO)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -fPIC $(foreach D,$(INC_DIRS),-I$D) \
$(AOCL_COMPILE_CONFIG) $(SRCS) $(AOCL_LINK_CONFIG) \
$(foreach D,$(LIB_DIRS),-L$D) \
$(foreach L,$(LIBS),-l$L) \
-o $(TARGET_DIR)/$(TARGET)
# Standard make targets
clean :
$(ECHO)rm -f $(TARGET_DIR)/$(TARGET)
.PHONY : all clean