Debian Codegraph @

src/scene/glsl/Makefile

raw symbols SCIP
1 # Generate Pascal include files from all GLSL code in source/ .
2 #
3 # Uses file_to_pascal_string, which is part of PasDoc. See:
4 # - PasDoc main webpage:
5 # https://github.com/pasdoc/pasdoc/wiki
6 # - file_to_pascal_string trivial source code (you can just get this one file and compile it yourself):
7 # https://github.com/pasdoc/pasdoc/blob/master/source/tools/file_to_pascal_string.dpr
8 #
9 # Placing source/ and generated-pascal/ in separate subdirectories makes it easier
10 # to browse, and to grep inside GLSL files, since you can easily grep only within source/ .
11 #
12 # Note that we flatten directory structure in generated-pascal/,
13 # to avoid the need to specify many include paths.
14 # It just seems easier to extend and reorganize the source/ directory freely this way.
15
16 ifneq (,$(filter $(OS),Windows_NT win64))
17 $(info Detected OS: Windows)
18 # Hack for Cygwin, to avoid using Windows built-in "find" program.
19 FIND:=`cygpath --mixed /bin/find`
20 else
21 $(info Detected OS: not Windows)
22 FIND:=find
23 endif
24
25 ALL_SOURCES := $(shell $(FIND) source/ \
26 -iname '*.fs' -or \
27 -iname '*.vs' -or \
28 -iname '*.gs' -or \
29 -iname '*.glsl')
30 ALL_OUTPUT := $(addsuffix .inc, \
31 $(subst lighting_model_phong/,lighting_model_phong_, \
32 $(subst lighting_model_physical/,lighting_model_physical_, \
33 $(subst lighting_model_unlit/,lighting_model_unlit_, \
34 $(subst source/,generated-pascal/, \
35 $(ALL_SOURCES))))))
36
37 .PHONY: all
38 all: $(ALL_OUTPUT)
39
40 generated-pascal/%.inc: source/%
41 file_to_pascal_string $< $@
42 generated-pascal/lighting_model_phong_%.inc: source/lighting_model_phong/%
43 file_to_pascal_string $< $@
44 generated-pascal/lighting_model_physical_%.inc: source/lighting_model_physical/%
45 file_to_pascal_string $< $@
46 generated-pascal/lighting_model_unlit_%.inc: source/lighting_model_unlit/%
47 file_to_pascal_string $< $@
48
49 .PHONY: clean
50 clean:
51 # rm -f $(ALL_OUTPUT)
52 # Clean all *.inc files, in case we renamed some files in source/
53 rm -f generated-pascal/*.inc