Skip to content

Instantly share code, notes, and snippets.

@fredmorcos
Last active August 29, 2015 14:05
Show Gist options
  • Save fredmorcos/0728031217533079cc90 to your computer and use it in GitHub Desktop.
Save fredmorcos/0728031217533079cc90 to your computer and use it in GitHub Desktop.
Makefile for building an X-less SDL2 program on the Raspberry Pi
CFLAGS += -Wall -Wextra -pedantic -std=c11 -g `sdl2-config --cflags`
LDFLAGS += `sdl2-config --libs`
.PHONY: clean run
%.o: %.c
$(CC) -I/opt/vc/include $(CFLAGS) -c $< -o $@
prog: main.o
$(CC) -L/opt/vc/lib $(LDFLAGS) $^ -o $@
run: prog
SDL_VIDEO_GL_DRIVER=/opt/vc/lib/libGLESv2.so ./prog
clean:
rm -f prog *.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment