普通文本  |  74行  |  1.57 KB

all : IID_to_MPH.c run_test

install : IID_to_MPH.c
	cp IID_to_MPH.c ../../src/autogen

CFLAGS = -I../../include -g -DNDEBUG
CFLAGS += -Wall -Werror

%.o : %.c
	gcc -c -o $@ $(CFLAGS) $<

IID_to_MPH.c : part1.c part2.c part3.c part4.c part5.c part6.c part7.c part8.c
	$(RM) $@
	cat part1.c part2.c part3.c part4.c part5.c part6.c part7.c part8.c >> $@

# part1.c is human-generated

part2.c : part23in.c
	$(RM) $@
	grep '#define MAX_HASH_VALUE' part23in.c > $@

part3.c : part23in.c
	$(RM) $@
# was 26,54p
	sed -n '/static const unsigned .* asso_values.. =/,/^    };/p' < part23in.c >> $@

# part4.c is human-generated

part5.c : part5gen
	./part5gen > $@

# part6.c is human-generated

part7.c : part23in.c hash.sed
# was 55p
	sed -n '/return.*asso_values/p' < part23in.c | sed -f hash.sed >> $@

# part8.c is human_generated

part23in.c : part23in.gperf
	gperf --null-strings --readonly-tables --no-strlen part23in.gperf > part23in.c

part23in.gperf : frag1
	./frag1 > part23in.gperf

frag1 : frag1.o OpenSLES_IID.o
	gcc -o $@ $(CFLAGS) $^

part5gen.c : frag2.c part23in.c frag3.c
	$(RM) $@
	cp frag2.c $@
	grep '#define MAX_HASH_VALUE' part23in.c >> $@
# was 81,156p
	sed -n '/static const char . const wordlist.. =/,/^    };/p' < part23in.c >> $@
	cat frag3.c >> $@

part5gen : part5gen.o OpenSLES_IID.o interfaces.o
	gcc -o $@ $(CFLAGS) $^

run_test : test
	./test

test : test.o OpenSLES_IID.o IID_to_MPH.o
	gcc -o $@ $(CFLAGS) $^

clean :
	$(RM) part5gen frag1 *.o
	$(RM) part23in.gperf part5gen.c part23in.c
	$(RM) part2.c part3.c part5.c part7.c
	$(RM) test

distclean : clean
	$(RM) IID_to_MPH.c