Skip to content

Instantly share code, notes, and snippets.

@Leandros Leandros/Makefile
Last active Mar 11, 2019

Embed
What would you like to do?
Minimal C++ Makefile
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
You can’t perform that action at this time.