summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 25 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..68fc418
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,25 @@
+PROG = sdl
+OBJS = $(PROG).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
+ $(CC) -c $(CFLAGS) $(SDL_CFLAGS) $(SDL_image_CFLAGS) $(PROG).c
+
+.PHONY: clean
+
+clean:
+ rm -f *.o ./$(PROG)