summaryrefslogtreecommitdiffstats
path: root/sdl/Makefile
blob: 0ea6faa8624cfc3bea4fbb09f79084f380e1ae68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
PROG = pyramid
OBJS = $(PROG).o math3d.o gltools.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 gltools.h
	$(CC) -c $(CFLAGS) $(SDL_CFLAGS) $(SDL_image_CFLAGS) $(PROG).c

math3d.o: math3d.c math3d.h
	$(CC) -c $(CFLAGS) math3d.c
	
gltools.o: gltools.c gltools.h math3d.h
	$(CC) -c $(CFLAGS) gltools.c	

.PHONY: clean

clean:
	rm -f *.o ./$(PROG)