Last active
January 8, 2022 23:18
-
-
Save Leandros/3a4bb52e2df399903fe9b244650d9547 to your computer and use it in GitHub Desktop.
Minimal C++ Makefile
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
CC = clang++ | |
CXX = clang++ | |
DEBUG = -ggdb -O1 -march=native | |
RELEASE = -O2 | |
CPPFLAGS := -I. | |
CXXFLAGS := $(DEBUG) -W -Wall -Wextra -std=c++17 | |
LDLIBS := -lm | |
OUTPUT_OPTION = -MMD -MP -o $@ -MJ $@.json | |
# Modify your C++ filesuffix here: | |
SRC := $(wildcard *.cpp) | |
OBJ := $(SRC:.cpp=.o) | |
DEP := $(SRC:.cpp=.d) | |
.PHONY: compile_commands clean | |
# You add new targets here: | |
all: test | |
# Add your objects here. | |
# Make sure one object has the same name as the target! | |
test: test.o dialog.o button.o | |
compile_commands: test | |
gsed -e '1s/^/[\n/' -e '$$s/,$$/\n]/' *.o.json > compile_commands.json | |
clean: | |
-rm -f $(OBJ) $(DEP) test | |
-include $(DEP) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment