Skip to content

Instantly share code, notes, and snippets.

@wirewc
Last active October 3, 2016 17:35
Show Gist options
  • Save wirewc/7344ca7c0ab86b2d4f529d7f05e9dca5 to your computer and use it in GitHub Desktop.
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++
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)
@wirewc
Copy link
Author

wirewc commented Oct 3, 2016

Change target to name of the file.cpp that will become the name of the executable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment