Instantly share code, notes, and snippets.

What would you like to do?
Basic Perfect Makefile for compiling target .cpp files using g++.
Basic Perfect Makefile for compiling target .cpp files with SDL2 libraries using g++.
#USEAGE: copy Makefile to folder with .cpp files then type "make"
#OBJS specifies which files to compile as part of the project
OBJS = $(wildcard *.cpp)
#CC specifies which compiler we're using
CC = g++
#COMPILER_FLAGS specifies the additional compilation options we're using
# -w suppresses all warnings
#LINKER_FLAGS specifies the libraries we're linking against
LINKER_FLAGS = -lSDL2 -lSDL2_image
#OBJ_NAME specifies the name of our exectuable
OBJ_NAME = $(patsubst %.cpp,%,$(wildcard *.cpp))
#This is the target that compiles our executable
all : $(OBJS)

This comment has been minimized.


VeggieVampire commented Jul 9, 2018

Tested on raspberry pi.

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