Skip to content

Instantly share code, notes, and snippets.

@arsaccol
Last active October 23, 2018 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arsaccol/f178082e2056c2f1f07e24b723bcc1c1 to your computer and use it in GitHub Desktop.
Save arsaccol/f178082e2056c2f1f07e24b723bcc1c1 to your computer and use it in GitHub Desktop.
Sample, generic-ish makefile with some SFML libraries being linked; pretty much copied this from some tutorial so I don't quite claim authorship. This makefile will generate one object file for every .cpp file without any regard for dependencies and then link them all together, so watch that you don't run an executable that was linked with outda…
CC = g++
CFLAGS = -std=c++11 -Wextra
LDFLAGS= -lsfml-graphics -lsfml-window -lsfml-system
EXEC = executable
SOURCES = $(wildcard *.cpp)
OBJECTS = $(SOURCES:.cpp=.o)
$(EXEC): $(OBJECTS)
$(CC) $(OBJECTS) -o $(EXEC) $(LDFLAGS)
%.o: %.cpp
$(CC) -c $(CFLAGS) $< -o $@
clean:
rm -f $(EXEC) $(OBJECTS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment