-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
52 lines (43 loc) · 1.61 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
#
# **************************************************************
# * Simple C++ Makefile Template *
# * *
# * Author: Arash Partow (2003) *
# * URL: http://www.partow.net/programming/makefile/index.html *
# * *
# * Copyright notice: *
# * Free use of this C++ Makefile template is permitted under *
# * the guidelines and in accordance with the the MIT License *
# * http://www.opensource.org/licenses/MIT *
# * *
# **************************************************************
#
CXX := -c++
CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror -g -Wno-unused-parameter -Wno-implicit-fallthrough
LDFLAGS := -L/usr/lib -lstdc++ -lm -lpthread
BUILD := build
OBJ_DIR := $(BUILD)/objects
APP_DIR := $(BUILD)/apps
TARGET := program
INCLUDE := -Iinclude/
SRC := \
$(wildcard src/Sierra/*.cpp) \
$(wildcard src/Sierra/SubParsers/*.cpp) \
$(wildcard src/TinyJS/*.cpp) \
$(wildcard src/*.cpp) \
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
all: build $(TARGET)
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGET) $(OBJECTS)
.PHONY: all build clean
build:
@mkdir -p $(APP_DIR)
@mkdir -p $(OBJ_DIR)
test:
$(APP_DIR)/$(TARGET) test/test01.js
clean:
rm -rf build/*