commit a97b0184b512ffe781d8573aeffa8577789d81bf
parent 81153bdbc220710adfac845d2491462e914d175c
Author: David DiPaola <DavidDiPaola@users.noreply.github.com>
Date: Tue, 22 May 2018 06:22:20 -0400
build: updated to allow building multiple binaries
Diffstat:
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,28 +1,28 @@
-SRC = \
+00_SRC = \
00-triangle.c \
ogl/_ogl.c ogl/ogl_init.c ogl/ogl_program_build.c ogl/ogl_program_attribute_get_ID.c ogl/ogl_vertex_buffer_load.c
-LIB = glew gl glfw3
-BIN = 00-triangle
-
-OBJ = $(SRC:.c=.o)
+00_OBJ = $(00_SRC:.c=.o)
+00_BIN = 00-triangle
CFLAGS ?= -std=c99 -Wall -fwrapv -g
LIB_CFLAGS += $(shell pkg-config --cflags glew gl glfw3)
LIB_LDFLAGS += $(shell pkg-config --libs glew gl glfw3)
+$(00_BIN): $(00_OBJ)
+
.PHONY: all
-all: $(BIN)
+all: $(00_BIN)
.PHONY: clean
clean:
- @echo [RM] $(OBJ) $(BIN)
- @rm -rf $(OBJ) $(BIN)
+ @rm -rf \
+ $(00_OBJ) $(00_BIN)
%.o: %.c
@echo [CC] $<
@$(CC) $(CFLAGS) $(LIB_CFLAGS) -c $< -o $@
-$(BIN): $(OBJ)
+%: %.o
@echo [LD] $^ -o $@
@$(CC) $(LDFLAGS) $^ -o $@ $(LIB_LDFLAGS)