Last active
February 20, 2019 15:20
-
-
Save icorbrey/dabd669beaac1c84b7c37e6d28083fdf to your computer and use it in GitHub Desktop.
My standard makefile, no frills
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIR_CURR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | |
DIR_DEPS = $(DIR_CURR)/include | |
DIR_SRC = $(DIR_CURR)/src | |
DIR_OBJ = $(DIR_CURR)/obj | |
DIR_BUILD = $(DIR_CURR)/build | |
SOURCES = $(wildcard $(DIR_SRC)/*.cpp) | |
OBJECTS = $(patsubst $(DIR_SRC)/%.cpp, $(DIR_OBJ)/%.o, $(SOURCES)) | |
DEPS = $(wildcard $(DIR_DEPS)/*.h) | |
COMPILER = clang++ | |
FLAGS = -I$(DIR_DEPS) -Wall -std=c++14 | |
$(DIR_OBJ)/%.o: $(DIR_SRC)/%.cpp $(DEPS) | |
$(COMPILER) $(FLAGS) -c $< -o $@ | |
$(DIR_BUILD)/build: $(OBJECTS) | |
$(COMPILER) $(FLAGS) $^ -o $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment