Last active
August 16, 2017 20:26
-
-
Save angrykoala/2079e5a62ce4d2fe34794c0dcb8028f1 to your computer and use it in GitHub Desktop.
Basic makefile
This file contains 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
# Basic Makefile | |
# by @angrykoala | |
CXX = g++ | |
CPPFLAGS = -Wall -O1 -std=c++11 -g | |
ASTYLE_FLAGS = --style=java --align-pointer=name --delete-empty-lines --indent-col1-comments --unpad-paren -n -Q | |
EXE = output_file | |
BIN_DIR = bin | |
INCLUDE_DIR = include | |
SRC_DIR = src | |
SRC = $(wildcard $(SRC_DIR)/*.cpp $(SRC_DIR)/*/*.cpp) | |
INC = $(wildcard $(INCLUDE_DIR)/*.hpp $(INCLUDE_DIR)/*/*.hpp) | |
main: $(BIN_DIR)/ $(BIN_DIR)/$(EXE) | |
.PHONY: clean | |
clean: | |
rm -rf $(BIN_DIR) | |
.PHONY: astyle | |
astyle: | |
astyle $(ASTYLE_FLAGS) $(SRC) $(INC) | |
#print makefile variable (for makefile debug purposes) | |
.PHONY: print-% | |
print-% : ; @echo $* = $($*) | |
$(BIN_DIR)/$(EXE): $(SRC) $(INC) | |
$(CXX) -o $@ $(SRC) $(CPPFLAGS) -I $(INCLUDE_DIR) | |
$(BIN_DIR)/: | |
mkdir $(BIN_DIR) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment