summaryrefslogtreecommitdiffstats
path: root/fiz/naloga/gl/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'fiz/naloga/gl/Makefile')
-rw-r--r--fiz/naloga/gl/Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/fiz/naloga/gl/Makefile b/fiz/naloga/gl/Makefile
new file mode 100644
index 0000000..7d04b8b
--- /dev/null
+++ b/fiz/naloga/gl/Makefile
@@ -0,0 +1,40 @@
+DESTDIR=/
+CC = cc
+cflags = -O0 -Wall -I. -fpic -Wformat-security -Wextra -pedantic -g3 $(shell pkg-config --cflags libstrophe)
+ldflags = $(shell pkg-config --libs glew) -lglfw
+PROJ = helmholtz
+# cflags and ldflags are used so that users specifying CFLAGS and LDFLAGS do not override my flags
+# += is not used, because gcc usually accepts last option, for example -O0 -O2 will use -O2
+.NOTPARALLEL:
+$(PROJ): vertex_shader.o fragment_shader.o $(PROJ).c
+ # $(CC) -c -DIX_LIB $(cflags) $(CFLAGS) $(PROJ).c
+ # $(CC) -shared -olib$(PROJ).so $(PROJ).o
+ # $(CC) -L. $(cflags) $(CFLAGS) $(PROJ).c -l$(PROJ) $(ldflags) -o$(PROJ)
+ $(CC) $(cflags) $(CFLAGS) $(PROJ).c $(ldflags) -o$(PROJ) *_shader.o
+
+%_shader.o: %.glsl
+ ld -r -b binary -o $@ $<
+
+install:
+ mkdir -p $(DESTDIR)/usr/bin # $(DESTDIR)/etc $(DESTDIR)/usr/include $(DESTDIR)/usr/lib
+ cp $(PROJ) $(DESTDIR)/usr/bin/
+ # cp $(PROJ).conf $(DESTDIR)/etc/$(PROJ)
+ # cp lib$(PROJ).so $(DESTDIR)/usr/lib/
+ # cp $(PROJ).h $(DESTDIR)/usr/include/
+
+distclean: clean
+
+clean:
+ rm -f $(PROJ) # $(PROJ).o lib$(PROJ).so
+
+uninstall:
+ rm -f $(DESTDIR)/usr/bin/$(PROJ) # $(DESTDIR)/etc/$(PROJ) $(DESTDIR)/usr/include/$(PROJ).h $(DESTDIR)/usr/lib/lib$(PROJ).so
+
+valgrind:
+ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt $(COMMAND)
+
+test:
+ ld -r -b binary -o vertex_shader.o vertex.glsl
+ gcc -Wall -Wextra -pedantic -Wformat -Wformat-security -g3 -O0 -otest test.c vertex_shader.o
+
+.PHONY: valgrind clean distclean install uninstall default test