Created
March 11, 2018 14:34
-
-
Save zapstar/b94b8f5077d5c8820bf8d87ad1d5ff92 to your computer and use it in GitHub Desktop.
Makefile to generate separate binaries for each source file
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=-Wall -Werror -std=c++11 | |
all: $(patsubst %.cpp, %.out, $(wildcard *.cpp)) | |
%.out: %.cpp Makefile | |
$(CXX) $(CXXFLAGS) $< -o $(@:.out=) | |
clean: $(patsubst %.cpp, %.clean, $(wildcard *.cpp)) | |
%.clean: | |
rm -f $(@:.clean=) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment