Fix heredoc/nowdoc bugs with large docs, docs crossing buffer boundaries
[hiphop-php.git] / hphp / idl / Makefile
blob571bd56c7735edcf985deaa894cb8b9878823201
2 V ?= @
4 IDL_PHPS = $(wildcard *.idl.php)
5 ifndef REPO_ADD
6 REPO_ADD = git add
7 endif
8 ifndef REPO_DEL
9 REPO_DEL = git rm
10 endif
12 PHP := $(wildcard /usr/local/hphpi/bin/hhvm)
13 PHP := $(if $(PHP),$(PHP) -v Preg.ErrorLog=false,php)
15 all:
17 lists: ../system/ext.inc ../test/test_ext.h ../test/test_ext.inc ../runtime/ext/ext.h
19 ../system/ext.inc: idl_list.php $(IDL_PHPS)
20 @echo 'Generating $@'
21 $(V)$(PHP) idl_list.php inc $@
22 $(V)touch ../compiler/builtin_symbols.cpp
24 ../test/test_ext.h: idl_list.php $(IDL_PHPS)
25 @echo 'Generating $@'
26 $(V)$(PHP) idl_list.php test_ext $@
28 ../test/test_ext.inc: idl_list.php $(IDL_PHPS)
29 @echo 'Generating $@'
30 $(V)$(PHP) idl_list.php test_suites $@
31 $(V)touch ../test/test.cpp
33 ../runtime/ext/ext.h: idl_list.php $(IDL_PHPS)
34 @echo 'Generating $@'
35 $(V)$(PHP) idl_list.php ext $@
37 $(EXT): $(EXT).idl.php idl.php base.php
38 @echo 'Generating files from $<...'
39 @echo ' --> ext_$@.h ext_$@.cpp'
40 $(V)$(PHP) idl.php cpp $< ext_$@.h ext_$@.cpp
41 @echo ' --> $@.inc'
42 $(V)$(PHP) idl.php inc $< $@.inc
43 @echo ' --> test_ext_$@.h test_ext_$@.cpp'
44 $(V)$(PHP) idl.php test $< test_ext_$@.h test_ext_$@.cpp
45 @echo ' --> ../runtime/ext/ext_$@.h ../runtime/ext/ext_$@.cpp'
46 $(V)$(PHP) idl.php param $< ../runtime/ext/ext_$@.h ../runtime/ext/ext_$@.cpp
48 # run this for a newly prepared idl file
49 install: $(EXT) lists
50 $(V)cp ext_$<.h ext_$<.cpp ../runtime/ext/
51 $(REPO_ADD) ../runtime/ext/ext_$<.h ../runtime/ext/ext_$<.cpp
52 $(V)cp $<.inc ../system/
53 $(REPO_ADD) ../system/$<.inc
54 $(V)touch ../compiler/builtin_symbols.cpp
55 $(V)cp test_ext_$<.h test_ext_$<.cpp ../test/
56 $(REPO_ADD) ../test/test_ext_$<.h ../test/test_ext_$<.cpp
57 $(V)$(PHP) ../../bin/license.php
59 # run this to add or remove a function from an existing idl file
60 update: $(EXT) lists
61 $(V)cp $<.inc ../system/
62 $(V)touch ../compiler/builtin_symbols.cpp
63 $(V)$(PHP) ../../bin/license.php
65 remove:
66 @echo 'Removing extension index...'
67 $(V)perl -p -i -n -e "s/#include \"$(EXT)\.inc\"\n//" \
68 ../system/ext.inc
69 @echo 'Regenerating dynamic tables...'
70 make -C ../ clobber && make -C ../ && make -C ../system
71 @echo 'Removing list files...'
72 $(V)perl -p -i -n -e "s/#include <test\/test_ext_$(EXT)\.h>\n//" \
73 ../test/test_ext.h
74 $(V)perl -p -i -n -e "s/RUN_TESTSUITE\(TestExt$(EXT)\);\n//i" \
75 ../test/test_ext.inc
76 $(V)perl -p -i -n -e "s/#include .*\/ext_$(EXT).h>\n//" \
77 ../runtime/ext/ext.h
78 @echo 'Removing source files...'
79 $(REPO_DEL) ../test/test_ext_$(EXT).h
80 $(REPO_DEL) ../test/test_ext_$(EXT).cpp
81 $(REPO_DEL) ../runtime/ext/ext_$(EXT).h
82 $(REPO_DEL) ../runtime/ext/ext_$(EXT).cpp
83 @echo 'Removing IDL file...'
84 $(REPO_DEL) $(EXT).idl.php
85 make -C ../ clobber && make -C ../
87 clean clobber:
88 $(V)rm -f *~ $(patsubst %.idl.php, %, $(IDL_PHPS)) $(patsubst %.idl.php, ext_%.h, $(IDL_PHPS)) $(patsubst %.idl.php, ext_%.cpp, $(IDL_PHPS)) $(patsubst %.idl.php, %.inc, $(IDL_PHPS)) $(patsubst %.idl.php, test_ext_%.h, $(IDL_PHPS)) $(patsubst %.idl.php, test_ext_%.cpp, $(IDL_PHPS))
90 # re-generating .inc files
92 %.geninc:
93 @php idl.php inc $(patsubst %.geninc, %.idl.php, $@) \
94 $(patsubst %.geninc, ../system/%.inc, $@)
96 geninc-all: $(patsubst %.idl.php, %.geninc, $(IDL_PHPS))
97 @php idl.php inc ../../facebook/extensions/string/string.idl.php \
98 ../../facebook/extensions/string/string.inc
99 @php idl.php inc ../../facebook/extensions/utils/utils.idl.php \
100 ../../facebook/extensions/utils/utils.inc
101 @php idl.php inc ../runtime/ext/sep/mhash/mhash.idl.php \
102 ../runtime/ext/sep/mhash/mhash.inc
103 @php idl.php inc ../system/helper.idl.php ../system/helper.inc
105 update-all:
106 @for c in $(patsubst %.idl.php, %, $(IDL_PHPS)); do $(MAKE) update EXT=$$c; done;
108 # re-generating .idl files
110 %.gendoc:
111 @php schema.php $(patsubst %.gendoc, %.idl.php, $@) -1 > $@.php
112 @mv -f $@.php $(patsubst %.gendoc, %.idl.php, $@)
114 gendoc-all: $(patsubst %.idl.php, %.gendoc, $(IDL_PHPS))
116 # re-generating doc comments for system classes
118 SYS_PHPS = $(wildcard ../system/classes/*.php)
120 %.sysdoc:
121 @php sysdoc.php $(patsubst %.sysdoc, %, $@)
123 sysdoc-all: $(patsubst %, %.sysdoc, $(SYS_PHPS))