Last active
December 12, 2017 15:01
-
-
Save nathiss/e6b2844923d7ef2addd06ef469bc7cbf to your computer and use it in GitHub Desktop.
General Makefile for C++ apps.
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++ | |
LD=g++ | |
CFLAGS= | |
LDFLAGS= | |
EXEC=out | |
SOURCES=$(wildcard *.cc) | |
OBJECTS=$(SOURCES:.cc=.o) | |
.PHONY: clean all run | |
all: clean $(EXEC) | |
run: all | |
./$(EXEC) | |
$(EXEC): $(OBJECTS) | |
$(LD) $(OBJECTS) $(LDFLAGS) -o $(EXEC) | |
%.o: %.cpp | |
$(CXX) -c $(CFLAGS) $< -o $@ | |
clean: | |
rm -rf $(EXEC) $(OBJECTS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment