summaryrefslogtreecommitdiffstats
path: root/sdl/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'sdl/Makefile')
-rw-r--r--sdl/Makefile26
1 files changed, 26 insertions, 0 deletions
diff --git a/sdl/Makefile b/sdl/Makefile
new file mode 100644
index 0000000..9e76257
--- /dev/null
+++ b/sdl/Makefile
@@ -0,0 +1,26 @@
+PROG = pyramid
+OBJS = $(PROG).o math3d.o
+CC = gcc
+DBGFLAGS = -g -O0
+ifdef DEBUG
+ CFLAGS = $(DBGFLAGS) -Wall -std=c99
+else
+ CFLAGS = -Wall -std=c99 -O2 -march=native -mtune=native
+endif
+LDFLAGS = -lGLEW -lGL -lGLU -lm -lglut
+SDL_CFLAGS := $(shell sdl-config --cflags)
+SDL_LDFLAGS := $(shell sdl-config --libs)
+SDL_image_CFLAGS := $(shell pkg-config --cflags SDL_image)
+SDL_image_LDFLAGS := $(shell pkg-config --libs SDL_image)
+
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) $(SDL_LDFLAGS) $(SDL_image_LDFLAGS) $(OBJS) -o $(PROG)
+
+$(PROG).o: $(PROG).c math3d.h
+ $(CC) -c $(CFLAGS) $(SDL_CFLAGS) $(SDL_image_CFLAGS) $(PROG).c
+
+math3d.o: math3d.c math3d.h
+ $(CC) -c $(CFLAGS) math3d.c
+
+clean:
+ rm -f *.o ./$(PROG)