mirror of
https://github.com/MichaelFisher1997/opengl-cpp.git
synced 2025-04-27 14:13:10 +00:00
42 lines
866 B
Plaintext
42 lines
866 B
Plaintext
![]() |
# A simple Makefile for compiling small SDL projects
|
||
|
|
||
|
# set the compiler
|
||
|
CC := clang
|
||
|
|
||
|
# set the compiler flags
|
||
|
CFLAGS := `sdl2-config --libs --cflags` -ggdb3 -O0 --std=c99 -Wall -lSDL2_image -lm
|
||
|
# add header files here
|
||
|
HDRS :=
|
||
|
|
||
|
# add source files here
|
||
|
SRCS := #file-name.c
|
||
|
|
||
|
# generate names of object files
|
||
|
OBJS := $(SRCS:.c=.o)
|
||
|
|
||
|
# name of executable
|
||
|
EXEC := #name your executable file
|
||
|
|
||
|
# default recipe
|
||
|
all: $(EXEC)
|
||
|
|
||
|
showfont: showfont.c Makefile
|
||
|
$(CC) -o $@ $@.c $(CFLAGS) $(LIBS)
|
||
|
|
||
|
glfont: glfont.c Makefile
|
||
|
$(CC) -o $@ $@.c $(CFLAGS) $(LIBS)
|
||
|
|
||
|
# recipe for building the final executable
|
||
|
$(EXEC): $(OBJS) $(HDRS) Makefile
|
||
|
$(CC) -o $@ $(OBJS) $(CFLAGS)
|
||
|
|
||
|
# recipe for building object files
|
||
|
#$(OBJS): $(@:.o=.c) $(HDRS) Makefile
|
||
|
# $(CC) -o $@ $(@:.o=.c) -c $(CFLAGS)
|
||
|
|
||
|
# recipe to clean the workspace
|
||
|
clean:
|
||
|
rm -f $(EXEC) $(OBJS)
|
||
|
|
||
|
.PHONY: all clean
|