aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 1f026a15d092fb546a9a8ab5da90b081e1d99ed4 (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
32
33
34
35
36
37
38
# Copyright (C) 2018 Tomasz Kramkowski <tk@the-tk.com>
# SPDX-License-Identifier: MIT
-include config.mk

PROG := gltest

EPRINTF_PATH ?= ../eprintf
PKG_CONFIG ?= pkg-config
LN ?= ln -sf

LIBS := glfw3
CPPFLAGS += -D__gl_h_
CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBS)) -std=c11 -MMD -MP
LDFLAGS += -Wl,--as-needed
LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBS)) -lm

OBJ := gltest.o loadgl.o eprintf.o vert.o frag.o glprog.o
DEP := $(OBJ:.o=.d)

%.o: %.glsl
	$(LD) -r -b binary $(OUTPUT_OPTION) $<

all: $(PROG)
$(PROG): $(OBJ)
clean:
	$(RM) $(OBJ) $(DEP) $(PROG) $(CLEAN)

loadgl.o gltest.o glprog.o: loadgl.h
loadgl.c loadgl.h: loadgl.%: loadgl.m4 loadgl.%.in
	m4 $^ >$@
CLEAN += loadgl.c loadgl.h

include $(EPRINTF_PATH)/module.mk
deplinks: $(EPRINTF_FILES)

-include $(DEP)

.PHONY: all clean