Last active
October 3, 2016 17:35
-
-
Save wirewc/7344ca7c0ab86b2d4f529d7f05e9dca5 to your computer and use it in GitHub Desktop.
General simple makefile I share with students and friends learning C or C++
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
CC = g++ | |
CFLAGS = -std=c++14 -Wall -fPIC -g | |
LDFLAGS = -std=c++14 -Wall -fPIC -g | |
TARGET = stuff | |
all: $(TARGET) | |
$(TARGET): $(TARGET).o | |
$(CC) -o $@ $^ $(LDFLAGS) | |
$(TARGET).o: $(TARGET).cpp | |
$(CC) -c $(CFLAGS) $< | |
.PHONY: clean cleanest | |
clean: | |
rm *.o $(TARGET) | |
cleanest: clean | |
rm $(TARGET) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change target to name of the file.cpp that will become the name of the executable.