Embeddable shaders

This commit is contained in:
2024-06-25 22:20:35 +02:00
parent 6025a5a614
commit 39dbf40cd3
4 changed files with 35 additions and 17 deletions

View File

@ -1,32 +1,39 @@
.PHONY: all clean run
VERSION = 0.0.1
.PHONY: all clean run bear build
VERSION = 0.0.2
PREFIX=/usr/local
LIBS = sdl2 glew
CMACRO = -DVERSION=\"$(VERSION)\"
CMACRO = -DVERSION=\"$(VERSION)\" $(if $(EMBED_SHADER),-DEMBED_SHADER,)
CC = gcc
CFLAGS = -g -Wall -Wextra -pedantic $(shell pkg-config $(LIBS) --cflags) $(CMACRO)
LDFLAGS = $(shell pkg-config $(LIBS) --libs) -lm
all: zoomer
all: zoomer
zoomer: zoomer.o
zoomer: $(if $(EMBED_SHADER),fshader.h vshader.h,) zoomer.o
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.h: %.glsl
xxd -i $< $@
clean:
rm -f fshader.h vshader.h
rm -f *.o
rm -f zoomer
install: zoomer
install -Dm755 $< $(DESTDIR)$(PREFIX)/bin/$<
install: build
install -Dm755 zoomer $(DESTDIR)$(PREFIX)/bin/zoomer
bear: clean
bear -- make
run: zoomer
build:
EMBED_SHADER=y $(MAKE) zoomer
run: zoomer
./$<