opengl_learn

Step-by-step introduction to OpenGL
git clone https://0xdd.org/code/opengl_learn.git
Log | Files | Refs | README | LICENSE

Makefile (1138B)


      1 SRC = \
      2 	_ogl.c ogl_init.c \
      3 	ogl_GLfloat_isapproxequal.c ogl_GLfloat_print.c \
      4 	ogl_mat4f_identity.c ogl_mat4f_isapproxequal.c ogl_mat4f_multiply.c ogl_mat4f_print.c ogl_mat4f_rotate.c ogl_mat4f_scale.c ogl_mat4f_translate.c \
      5 	ogl_program_build.c ogl_program_uniform_get_ID.c ogl_program_uniform_set_mat4f.c \
      6 	ogl_vec3f_cross.c ogl_vec3f_dot.c ogl_vec3f_isapproxequal.c ogl_vec3f_magnitude.c ogl_vec3f_normal.c ogl_vec3f_print.c \
      7 	ogl_arraybuffer_load.c \
      8 	ogl_lookat.c ogl_perspective.c
      9 OBJ = $(SRC:.c=.o)
     10 BIN = ogl.a
     11 TEST = \
     12 	mat4f_multiply.test \
     13 	vec3f_cross.test vec3f_magnitude.test vec3f_normal.test
     14 
     15 CFLAGS ?= -std=c99 -Wall -fwrapv -g
     16 LIB_CFLAGS  += $(shell pkg-config --cflags glew gl glfw3)
     17 LIB_LDFLAGS += $(shell pkg-config --libs   glew gl glfw3) -lm
     18 
     19 .PHONY: all
     20 all: $(BIN)
     21 
     22 .PHONY: test
     23 test: $(TEST)
     24 	@for t in $^ ; do \
     25 		./$$t ; \
     26 	done
     27 
     28 .PHONY: clean
     29 clean:
     30 	@rm -rf $(OBJ) $(TEST) $(BIN)
     31 
     32 %.o: %.c
     33 	@echo [CC] $<
     34 	@$(CC) $(CFLAGS) $(LIB_CFLAGS) -c $< -o $@
     35 
     36 $(BIN): $(OBJ)
     37 	@echo [AR] cvq $@ $^
     38 	@ar cvq $@ $^ > /dev/null
     39 
     40 %.test: %.test.o $(BIN)
     41 	@echo [CC] $^ -o $@
     42 	@$(CC) $(LDFLAGS) $^ -o $@ $(LIB_LDFLAGS)
     43