#
|
|
# **************************************************************
|
|
# * 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 := -g++-7
|
|
CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror -O3 -Wno-unused-parameter -std=c++17
|
|
LDFLAGS := -L/usr/lib -lstdc++ -lm -lpthread
|
|
BUILD := build
|
|
OBJ_DIR := $(BUILD)/objects
|
|
APP_DIR := $(BUILD)/apps
|
|
TARGET := program
|
|
INCLUDE := -Iinclude/
|
|
SRC := \
|
|
$(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)
|
|
|
|
clean:
|
|
rm -rf build/*
|