]> git.saurik.com Git - cycript.git/blob - Makefile.am
Repair build when JavaScriptCore is not available.
[cycript.git] / Makefile.am
1 # Cycript - The Truly Universal Scripting Language
2 # Copyright (C) 2009-2016 Jay Freeman (saurik)
3
4 # GNU Affero General Public License, Version 3 {{{
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
15 #
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # }}}
19
20 .DELETE_ON_ERROR:
21
22 AUTOMAKE_OPTIONS = subdir-objects
23 CLEANFILES =
24 SUBDIRS =
25
26 ACLOCAL_AMFLAGS = -I m4
27
28 AM_CPPFLAGS = -DYYDEBUG=1 -DCY_SYSTEM="\"$(CY_SYSTEM)\""
29 AM_CPPFLAGS += -include config.h -include $(srcdir)/unconfig.h
30
31 CY_FLAGS =
32 CY_FLAGS += -fvisibility=hidden
33
34 if CY_ANDROID
35 CY_FLAGS += -fPIE
36 endif
37
38 AM_CFLAGS = $(CY_FLAGS)
39 AM_CXXFLAGS = $(CY_FLAGS)
40 AM_OBJCXXFLAGS = $(CY_FLAGS)
41 AM_LDFLAGS = $(CY_FLAGS)
42
43 if CY_ANDROID
44 AM_LDFLAGS += -rdynamic -fPIE -pie
45 endif
46
47 AM_OBJCXXFLAGS += -fobjc-exceptions
48
49 CY_LDFLAGS = -no-undefined -avoid-version -export-dynamic
50
51 datdir = $(libdir)
52 dat_DATA =
53
54 lib_LTLIBRARIES =
55
56 lib_LTLIBRARIES += libcycript.la
57 libcycript_la_LDFLAGS = $(CY_LDFLAGS)
58 libcycript_la_LIBADD = $(LTLIBUV) $(LTLIBFFI) $(LTLIBSQLITE3) $(LTLIBGCC) -ldl
59
60 libcycript_la_SOURCES = ConvertUTF.c Driver.cpp Error.cpp Highlight.cpp Library.cpp Network.cpp Output.cpp Replace.cpp Syntax.cpp
61 libcycript_la_SOURCES += Parser.cpp Scanner.cpp
62
63 filters =
64
65 if CY_CONSOLE
66 bin_PROGRAMS = cycript
67 cycript_SOURCES = Console.cpp
68 cycript_LDADD = libcycript.la $(LTLIBREADLINE) $(LTLIBTERMCAP) $(LTLIBGCC) $(PTHREAD_CFLAGS) -ldl
69 libcycript_la_SOURCES += Complete.cpp
70
71 if CY_EXECUTE
72 cycript_SOURCES += Inject.cpp
73 endif
74
75 if CY_ANDROID
76 bin_PROGRAMS += cycript-pie
77 cycript_pie_SOURCES = pie.c
78 cycript_pie_LDFLAGS = -fno-PIE
79 endif
80 endif
81
82 if CY_EXECUTE
83 libcycript_la_SOURCES += sig/ffi_type.cpp sig/parse.cpp sig/copy.cpp
84 libcycript_la_SOURCES += Decode.cpp Execute.cpp Handler.cpp JavaScriptCore.cpp
85 libcycript_la_LIBADD += $(LTJAVASCRIPTCORE)
86 dat_DATA += libcycript.db
87
88 AM_CPPFLAGS += -DCY_EXECUTE
89 filters += C
90
91 CLEANFILES += libcycript.db
92 libcycript.db: Bridge.def libcycript.py
93 $(srcdir)/libcycript.py $(CY_SYSTEM) $@ $(srcdir) <$<
94
95 if CY_PRELINK
96 CY_LANGFLAGS = -DCY_JAVA=$(CY_JAVA) -DCY_PYTHON=$(CY_PYTHON) -DCY_OBJECTIVEC=$(CY_OBJECTIVEC)
97
98 if CY_ANDROID
99 CY_ANDFLAGS = -U__APPLE__ -D__ANDROID__
100 else
101 CY_ANDFLAGS =
102 endif
103
104 CLEANFILES += Analyze
105 Analyze: Analyze.cpp Error.cpp Output.cpp Replace.cpp Syntax.cpp
106 $(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) -std=c++11 $(LDFLAGS_FOR_BUILD) $(CY_LANGFLAGS) -I$(srcdir)/extra -o $@ $^ $(CY_LIBCLANG) -Wno-bitwise-op-parentheses -Wno-dangling-else -Wno-logical-op-parentheses
107
108 CLEANFILES += Bridge.def
109 Bridge.def: Analysis.cpp Analyze Bridge.old
110 ./Analyze $< $(OBJCXX) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(CY_LANGFLAGS) $(CY_ANDFLAGS) >$@
111 cat $(srcdir)/Bridge.old >>$@
112 else
113 CLEANFILES += Bridge.def
114 Bridge.def: Bridge.def.in
115 cat $< >$@
116 endif
117
118 #CLEANFILES += Hasher.gperf
119 #Hasher.gperf: Hasher.def Hasher.sh
120 # $(srcdir)/Hasher.sh <$< >$@
121
122 #CLEANFILES += Hasher.hpp
123 #Hasher.hpp: Hasher.gperf
124 # $(GPERF) $< >$@
125 endif
126
127 if CY_JAVA
128 filters += Java
129 libcycript_la_SOURCES += Java/Execute.cpp
130 dat_DATA += libcycript.jar
131
132 CLEANFILES += Class
133 Class/Cycript.class: Java/Cycript.java
134 rm -rf Class; mkdir Class; javac -g -Xlint:unchecked -source 1.5 -target 1.5 -d Class -sourcepath $(srcdir)/Java $<
135 Class/classes.dex: Class/Cycript.class
136 cd Class; dx --dex --output=../$@ *.class
137
138 CLEANFILES += libcycript.jar
139 libcycript.jar: Class/classes.dex Class/Cycript.class
140 cd Class; jar cf ../$@ *
141 endif
142
143 if CY_RUBY
144 filters += Ruby
145 libcycript_la_SOURCES += Ruby/Execute.cpp
146 libcycript_la_LIBADD += $(LTRUBY)
147 endif
148
149 if CY_PYTHON
150 filters += Python
151 libcycript_la_SOURCES += Python/Execute.cpp
152 libcycript_la_LIBADD += $(LTPYTHON)
153 endif
154
155 if CY_OBJECTIVEC
156 AM_CPPFLAGS += -DCY_OBJECTIVEC
157 filters += ObjectiveC
158 libcycript_la_SOURCES += ObjectiveC/Output.cpp ObjectiveC/Replace.cpp ObjectiveC/Library.mm
159 libcycript_la_LIBADD += $(LTOBJECTIVEC)
160 endif
161
162 CLEANFILES += Parser.ypp
163 Parser.ypp: Parser.ypp.in
164 $(srcdir)/Filter.sh $< >$@ $(filters)
165
166 CLEANFILES += Scanner.lpp
167 Scanner.lpp: Scanner.lpp.in UnicodeIDStart.l UnicodeIDContinue.l
168 $(srcdir)/Filter.sh $< >$@ $(filters)
169
170 CLEANFILES += Scanner.cpp Scanner.output lex.backup
171 Scanner.cpp: Scanner.lpp
172 $(FLEX) $(LFLAGS) -o $@ -T $< 2>Scanner.output || (grep -F '$<:' Scanner.output; false)
173 @#grep -E '^(No backing up\.|Compressed tables always back up\.)$$' lex.backup >/dev/null
174 ! grep -n '^ jam-transitions: ' lex.backup | grep -v ': EOF \[\(\]\| \\2\)'
175 ! grep -F ': warning, ' Scanner.output || true
176
177 Scanner.lo: Parser.hpp IdentifierStart.h IdentifierContinue.h
178 Parser.lo: Parser.hpp
179 Parser.cpp: Parser.hpp
180
181 CLEANFILES += Parser.cpp Parser.hpp stack.hh Parser.output
182 Parser.hpp: Parser.ypp
183 $(BISON) -v --report=state -Werror -o Parser.cpp $<
184 ! grep -n '^State [0-9]* conflicts:' Parser.output
185 ! grep -n '^ *.* *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output | grep -v '$$default'
186 ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep 'shift, and go to state [0-9]*$$'
187 ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep -v '$$default' | grep 'reduce using rule [0-9]* ([^)]*)$$'
188 perl -pi -e 's/yytranslate_ \(yylex \(/(yylex_ (/g' Parser.cpp