summaryrefslogtreecommitdiffstats
path: root/o3d/compiler/glsl_validator/Makefile
blob: 60dba47494375fe21a19903323645f078cd79453 (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
# Makefile for the Flex/Bison GLSL ES grammar and simple test harness.
# "make" to build everything.
# "make clean" to clean the build.
# "make test" to run tests.

CC=gcc
BUILD=build
SRC=glsl_es

LEXER_INPUT=$(SRC)/GLSL_ES.l
GRAMMAR_INPUT=$(SRC)/GLSL_ES.y
GRAMMAR_INPUTS=$(LEXER_INPUT) $(GRAMMAR_INPUT)
LEXER_OUTPUT=$(BUILD)/GLSL_ES.lex.c
GRAMMAR_OUTPUT=$(BUILD)/GLSL_ES.tab.c
GRAMMAR_OUTPUTS=$(LEXER_OUTPUT) $(GRAMMAR_OUTPUT)

$(BUILD)/GLSLESParser: $(GRAMMAR_OUTPUTS)
	$(CC) -I$(BUILD) $(GRAMMAR_OUTPUTS) -o $(BUILD)/GLSLESParser

$(GRAMMAR_OUTPUTS): $(GRAMMAR_INPUTS)
	mkdir -p $(BUILD)
	lex -o $(LEXER_OUTPUT) $(LEXER_INPUT)
	bison -o $(GRAMMAR_OUTPUT) -v -d --debug $(GRAMMAR_INPUT)

.PHONY: test

test:
	@for i in $(shell ls shaders/*.vert) $(shell ls shaders/*.frag) ; do \
		echo Parsing $$i ; \
		time $(BUILD)/GLSLESParser < $$i ; \
	done

clean:
	rm $(BUILD)/GLSLESParser $(GRAMMAR_OUTPUTS) $(BUILD)/GLSL_ES.output $(BUILD)/GLSL_ES.tab.h