-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (57 loc) · 1.83 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
## ###############################################################
# Project specific part
#
# A recursively expanded variable: ‘=’
# Simply expanded variables are defined by lines using ‘:=’ or ‘::=’
#
# ###############################################################
# target name
TARGET := hellomake
# object file and build directory
OBJ_DIR := ./obj
BUILD_DIR := ./build
# include directories
#~ INC_DIRS := \
#~ ./inc
INC_DIRS = \
-Iinc
# ld
LFLAGS = \
-lPocoFoundation \
-lPocoUtil \
-L /usr/local/lib/
# sources
SRCS := \
./src/main.cpp \
./src/myapp.cpp
## ###############################################################
## ###############################################################
# General part
# ###############################################################
# The value of the make variable VPATH specifies a list of directories
# that make should search. Most often, the directories are expected to
# contain prerequisite files that are not in the current directory;
# however, make uses VPATH as a search list for both prerequisites and
# targets of rules.
# [https://www.gnu.org/software/make/manual/html_node/General-Search.html]
VPATH := $(dir $(SRCS))
# object files
OBJS := \
$(patsubst %.cpp, $(OBJ_DIR)/%$(ARCH)$(DEBUG).o, $(notdir $(SRCS)))
# create object files
#~ $(OBJ_DIR)/%$(ARCH)$(DEBUG).o : %.cpp Makefile
#~ @echo creating $@ ...
#~ $(CXX) -I$(INC_DIRS) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
$(OBJ_DIR)/%$(ARCH)$(DEBUG).o : %.cpp Makefile
@echo creating $@ ...
$(CXX) $(INC_DIRS) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
# build target
$(BUILD_DIR)/$(TARGET): $(OBJS)
@echo building output ...
$(CXX) -o $(BUILD_DIR)/$(TARGET) $(OBJS) $(LFLAGS)
# clean
.PHONY: clean
clean:
rm --force $(OBJ_DIR)/*.o
rm --force $(BUILD_DIR)/$(TARGET)
## ###############################################################