diff options
Diffstat (limited to 'sdl/Makefile')
-rw-r--r-- | sdl/Makefile | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sdl/Makefile b/sdl/Makefile index c0683c9..580179b 100644 --- a/sdl/Makefile +++ b/sdl/Makefile @@ -1,11 +1,12 @@ PROG = pyramid OBJS = $(PROG).o math3d.o gltools.o glframe.o shader.o CC = gcc +CFLAGS = -Wall -std=c99 DBGFLAGS = -g -O0 ifdef DEBUG - CFLAGS = $(DBGFLAGS) -Wall -std=c99 + CFLAGS += $(DBGFLAGS) else - CFLAGS = -Wall -std=c99 -O2 -march=native -mtune=native + CFLAGS += -O2 -march=native -mtune=native endif LDFLAGS = -lGLEW -lGL -lGLU -lm -lglut SDL_CFLAGS := $(shell sdl-config --cflags) @@ -14,22 +15,22 @@ 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) + $(CC) $(LDFLAGS) $(SDL_LDFLAGS) $(SDL_image_LDFLAGS) $(OBJS) -o $@ -$(PROG).o: $(PROG).c math3d.h gltools.h glframe.h - $(CC) -c $(CFLAGS) $(SDL_CFLAGS) $(SDL_image_CFLAGS) $(PROG).c +$(PROG).o: %.o: %.c math3d.h gltools.h glframe.h + $(CC) -c $(CFLAGS) $(SDL_CFLAGS) $(SDL_image_CFLAGS) $< -math3d.o: math3d.c math3d.h - $(CC) -c $(CFLAGS) math3d.c +math3d.o: %.o: %.c %.h + $(CC) -c $(CFLAGS) $< -gltools.o: gltools.c gltools.h math3d.h - $(CC) -c $(CFLAGS) gltools.c +gltools.o: %.o: %.c %.h math3d.h + $(CC) -c $(CFLAGS) $< -glframe.o: glframe.c glframe.h math3d.h - $(CC) -c $(CFLAGS) glframe.c +glframe.o: %.o: %.c %.h math3d.h + $(CC) -c $(CFLAGS) $< -shader.o: shader.c shader.h math3d.h - $(CC) -c $(CFLAGS) shader.c +shader.o: %.o: %.c %.h math3d.h + $(CC) -c $(CFLAGS) $< .PHONY: clean |