Last active
November 1, 2016 17:18
-
-
Save jiafulow/b4822f833d153440e79863ec0948c400 to your computer and use it in GitHub Desktop.
Makefile example from http://stackoverflow.com/questions/16886591/how-do-i-enable-c11-in-gcc
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
CXX=clang++ | |
CXXFLAGS=-g -std=c++11 -Wall -pedantic | |
BIN=prog | |
SRC=$(wildcard *.cpp) | |
OBJ=$(SRC:%.cpp=%.o) | |
# $^ is all the dependencies | |
# $? is all the modified dependencies | |
all: $(OBJ) | |
$(CXX) -o $(BIN) $^ | |
# $@ is the the target | |
# $< is the the first dependency | |
%.o: %.c | |
$(CXX) $@ -c $< | |
clean: | |
rm -f *.o | |
rm $(BIN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment