Created
February 5, 2018 08:42
-
-
Save yuvalif/ad5a527c10bc90658fd9247bf2865de4 to your computer and use it in GitHub Desktop.
Making all .cpp files in the directory, each one into its own target
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
# making all .cpp files in the directory | |
# each one into its own target | |
CXX ?= g++ | |
CXXFLAGS ?= -Wall -std=c++11 | |
.PHONY: all clean | |
SRCS = $(wildcard *.cpp) | |
PROGS = $(patsubst %.cpp,%,$(SRCS)) | |
all: $(PROGS) | |
%: %.cpp | |
$(CXX) $(CXXFLAGS) -o $@ $< | |
clean: | |
rm -f $(PROGS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment