Created
April 29, 2020 08:23
-
-
Save Ghost-VR/4abb08a823b854e8309527a2d1587c7b to your computer and use it in GitHub Desktop.
A very simple and efficient Makefile for C++, good for course projects!
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 :=g++ | |
CXXFLAGS :=-Wall | |
SRCS :=$(wildcard *.cpp) | |
SRCS :=$(filter-out demo.cpp, $(SRCS)) | |
SRCS_H :=$(patsubst %.cpp, %.h, $(SRCS)) | |
OBJS :=$(patsubst %.cpp, %.o, $(SRCS)) | |
all: build | |
run: build | |
./demo | |
submit: | |
zip submission.zip *.h *.cpp *.md Makefile | |
$(OBJS): $(SRCS) $(SRCS_H) | |
clean: | |
-rm $(OBJS) | |
-rm demo | |
build: demo.cpp $(OBJS) | |
$(CXX) $(CXXFLAGS) -o demo demo.cpp $(OBJS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment