Skip to content

Instantly share code, notes, and snippets.

@yuvalif
Created February 5, 2018 08:42
Embed
What would you like to do?
Making all .cpp files in the directory, each one into its own target
# 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