From 3967fb533c8565321bf27a7c41b68adba04fa535 Mon Sep 17 00:00:00 2001 From: dankan1890 Date: Sat, 22 Oct 2016 21:43:33 +0200 Subject: [PATCH] Improved and fixed example/Makefile. --- example/Makefile | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/example/Makefile b/example/Makefile index 552a5cd..22829a2 100644 --- a/example/Makefile +++ b/example/Makefile @@ -1,38 +1,41 @@ # Flags CFLAGS = -std=c99 -pedantic -O2 +LIBS := ifeq ($(OS),Windows_NT) BIN := $(BIN).exe -LIBS = -lglfw3 -lopengl32 -lm -lGLU32 -lGLEW32 + LIBS := -lglfw3 -lopengl32 -lm -lGLU32 -lGLEW32 else UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) - LIBS = -lglfw3 -framework OpenGL -lm -lGLEW -L/usr/local/lib + LIBS := -lglfw3 -framework OpenGL -lm -lGLEW -L/usr/local/lib CFLAGS += -I/usr/local/include else - LIBS = -lglfw -lGL -lm -lGLU -lGLEW + LIBS := -lglfw -lGL -lm -lGLU -lGLEW endif endif -all: file_browser extended canvas skinning +all: generate file_browser extended canvas skinning -file_browser: - @mkdir -p bin - rm -f bin/file_browser $(OBJS) +generate: clean +ifeq ($(OS),Windows_NT) + @mkdir bin 2> nul || exit 0 +else + @mkdir -p bin +endif + +clean: + @rm -rf bin + +file_browser: generate $(CC) $(CFLAGS) -o bin/file_browser file_browser.c $(LIBS) -extended: - @mkdir -p bin - rm -f bin/extended $(OBJS) +extended: generate $(CC) $(CFLAGS) -o bin/extended extended.c $(LIBS) -canvas: - @mkdir -p bin - rm -f bin/canvas $(OBJS) +canvas: generate $(CC) $(CFLAGS) -o bin/canvas canvas.c $(LIBS) -skinning: - @mkdir -p bin - rm -f bin/skinning $(OBJS) +skinning: generate $(CC) $(CFLAGS) -o bin/skinning skinning.c $(LIBS)