]> git.saurik.com Git - cycript.git/blame - GNUmakefile.in
Added CalEventIsAllDay to Bridge.def for Element.
[cycript.git] / GNUmakefile.in
CommitLineData
3530897b
DWT
1# @configure_input@
2
9c60689e
DWT
3SHELL := @_BASH@
4VPATH := @srcdir@
5
6ifndef PKG_TARG
7target :=
8else
9target := $(PKG_TARG)-
10endif
11
12srcdir := @srcdir@
13top_builddir := @top_builddir@
14flex := @FLEX@
15libtool := @LIBTOOL@
16cxx := @CXX@
17objcxx := @OBJCXX@
b128dfee 18cflags := @CPPFLAGS@ @CXXFLAGS@ -DYYDEBUG=1 @DEFS@
47aaa820 19objcxxflags := @OBJCXXFLAGS@
549f29b5
DWT
20ldflags := @LDFLAGS@
21library := @LIBS@ @LTLIBAPR@ @LTLIBICONV@
3530897b 22time := $(shell which @TIME@)
3fd51f51 23gperf := @GPERF@
3530897b
DWT
24
25INSTALL := @INSTALL@
26INSTALL_PROGRAM := @INSTALL_PROGRAM@
27INSTALL_DATA := @INSTALL_DATA@
28
29PACKAGE_TARNAME := @PACKAGE_TARNAME@
30prefix := @prefix@
31exec_prefix := @exec_prefix@
32bindir := @bindir@
33sbindir := @sbindir@
34libexecdir := @libexecdir@
35datarootdir := @datarootdir@
36datadir := @datadir@
37sysconfdir := @sysconfdir@
38sharedstatedir := @sharedstatedir@
39localstatedir := @localstatedir@
40includedir := @includedir@
41oldincludedir := @oldincludedir@
42docdir := @docdir@
43infodir := @infodir@
44htmldir := @htmldir@
45dvidir := @dvidir@
46pdfdir := @pdfdir@
47psdir := @psdir@
48libdir := @libdir@
49localedir := @localedir@
50mandir := @mandir@
9c60689e 51
3fd51f51 52CY_EXECUTE := @CY_EXECUTE@
47aaa820 53CY_OBJECTIVEC := @CY_OBJECTIVEC@
3fd51f51 54
9c60689e 55paths := $(foreach path,$(paths),$(wildcard $(path)))
549f29b5 56cflags += $(foreach path,$(paths),-I$(path) -L$(path))
9c60689e 57
3530897b 58svn := $(shell svnversion $(srcdir))
9c60689e
DWT
59
60all:
61all := cycript
62
63dpkg_architecture := $(shell which dpkg-architecture 2>/dev/null)
64ifneq ($(dpkg_architecture),)
65arch := $(shell $(dpkg_architecture) -qDEB_HOST_ARCH 2>/dev/null)
66endif
67
68header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp Internal.hpp Error.hpp String.hpp Exception.hpp Standard.hpp
69
70code :=
549f29b5
DWT
71code += Replace.lo Output.lo
72code += Cycript.tab.lo lex.cy.lo
73code += Network.lo Parser.lo
74code += JavaScriptCore.lo Library.lo
9c60689e
DWT
75
76inject :=
77
78filters := #E4X
79ldid := true
80entitle := $(ldid)
81lib := lib
82dll := so
9c60689e
DWT
83depends :=
84
85restart ?= $(MAKE)
86uname_s ?= $(shell uname -s)
87uname_p ?= $(shell uname -p)
88
3fd51f51
DWT
89ifeq ($(CY_EXECUTE),1)
90cflags += -DCY_EXECUTE
91code += sig/ffi_type.lo sig/parse.lo sig/copy.lo
92code += Execute.lo Bridge.lo
93filters += C
94#ifeq ($(filter ObjectiveC,$(filters)),)
95#ifneq ($(shell which gnustep-config 2>/dev/null),)
96#include GNUstep.mk
97#endif
98#endif
9c60689e
DWT
99endif
100
549f29b5
DWT
101cflags += -Wall -Werror -Wno-parentheses #-Wno-unused
102cflags += -fno-common
9c60689e 103ifneq ($(srcdir),.)
549f29b5 104cflags += -I.
9c60689e 105endif
549f29b5 106cflags += -I$(srcdir) -I$(srcdir)/include
9c60689e 107
a7f2d052 108all += libcycript.la
9c60689e
DWT
109
110filters += $(shell bison <(echo '%code{}%%_:') -o/dev/null 2>/dev/null && echo Bison24 || echo Bison23)
111
112ifdef arch
113deb := $(shell grep ^Package: $(srcdir)/control.in | cut -d ' ' -f 2-)_$(shell grep ^Version: $(srcdir)/control.in | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_$(arch).deb
114
115all:
116
117extra::
118
119ifeq ($(depends)$(dll),dylib)
120control.tmp: control.in cycript $(lib)cycript.dylib
121 sed -e 's/&/'"$$(dpkg-query -S $$(otool -lah cycript *.dylib | grep dylib | grep -v ':$$' | sed -e 's/^ *name //;s/ (offset [0-9]*)$$//' | sort -u) 2>/dev/null | sed -e 's/:.*//; /^cycript$$/ d; s/$$/,/' | sort -u | tr '\n' ' ')"'/;s/, $$//;s/#/$(svn)/;s/%/$(arch)/' $< >$@
122else
123ifeq ($(depends)$(dll),so)
124control.tmp: control.in cycript $(lib)cycript.so
125 sed -e 's/&/'"$$(dpkg-query -S $$(ldd cycript $(lib)cycript.so | sed -e '/:$$/ d; s/^[ \t]*\([^ ]* => \)\?\([^ ]*\) .*/\2/' | sort -u) 2>/dev/null | sed -e 's/:.*//; /^cycript$$/ d; s/$$/,/' | sort -u | tr '\n' ' ')"'/;s/, $$//;s/#/$(svn)/;s/%/$(arch)/' $< >$@
126else
127control.tmp: control.in
128 sed -e 's/&/$(foreach depend,$(depends),$(depend),)/;s/,$$//;s/#/$(svn)/;s/%/$(arch)/' $< >$@
129endif
130endif
131
132control: control.tmp
133 [[ -e control ]] && diff control control.tmp &>/dev/null || cp -pRf control.tmp control
134
135$(deb): $(all) control
136 rm -rf package
137 mkdir -p package/DEBIAN
138 cp -pR control package/DEBIAN
139 mkdir -p package/usr/{bin,lib,sbin}
140 $(restart) extra
141 cp -pR $(lib)cycript.$(dll) package/usr/lib
142 cp -pR cycript package/usr/bin
143 #cp -pR cyrver package/usr/sbin
144 dpkg-deb -b package $(deb)
145endif
146
3fd51f51
DWT
147ifeq ($(CY_EXECUTE),1)
148Bridge.gperf: Bridge.def Bridge.sh
149 $(srcdir)/Bridge.sh $< >$@
150
151Bridge.hpp: Bridge.gperf
152 $(gperf) $< | sed -e 's/defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__/0/' >$@
153
154Bridge.lo: Bridge.hpp
155endif
156
47aaa820
DWT
157ifeq ($(CY_OBJECTIVEC),1)
158filters += ObjectiveC
159header += Struct.hpp ObjectiveC/Internal.hpp ObjectiveC/Syntax.hpp
160code += ObjectiveC/Output.lo ObjectiveC/Replace.lo ObjectiveC/Library.lo
161
162Struct.hpp:
163 $$($(objcxx) -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
164endif
165
9c60689e
DWT
166all: $(all)
167
168clean::
a7f2d052 169 rm -rf *.lo *.o *.d .libs */*.lo */.libs libcycript.la $(all) Struct.hpp lex.cy.c Cycript.tab.cc Cycript.tab.hh location.hh position.hh stack.hh cyrver Cycript.yy Cycript.l control Bridge.gperf Bridge.hpp Cycript.output
94690cff
DWT
170ifneq ($(srcdir),.)
171 rm -rf sig ObjectiveC
172endif
9c60689e
DWT
173
174distclean: clean
175 rm -f GNUmakefile config.log config.status libtool
176
177%.yy: %.yy.in
178 $(srcdir)/Filter.sh <$< >$@ $(filters)
179
180%.l: %.l.in
181 $(srcdir)/Filter.sh <$< >$@ $(filters)
182
183Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.yy
184 bison -v --report=state $<
185
186lex.cy.c: Cycript.l
187 $(flex) -t $< | sed -e 's/int yyl;/yy_size_t yyl;/;s/int yyleng_r;/yy_size_t yyleng_r;/' >$@
188
189#Parser.hpp: Parser.py Parser.dat
190# ./Parser.py <Parser.dat >$@
191
549f29b5
DWT
192Cycript.tab.lo: Cycript.tab.cc $(header)
193 $(libtool) --mode=compile $(cxx) $(cflags) -c -o $@ $<
9c60689e 194
549f29b5
DWT
195lex.cy.lo: lex.cy.c $(header)
196 $(libtool) --mode=compile $(cxx) $(cflags) -c -o $@ $<
9c60689e 197
549f29b5
DWT
198%.lo: %.cpp $(header)
199 $(libtool) --mode=compile $(cxx) $(cflags) -c -o $@ $<
9c60689e 200
549f29b5 201%.lo: %.mm $(header)
47aaa820 202 $(libtool) --mode=compile $(objcxx) $(objcxxflags) $(cflags) -c -o $@ $<
9c60689e 203
a7f2d052 204libcycript.la: $(code)
3530897b 205 $(libtool) --mode=link $(cxx) $(ldflags) -o $@ $(filter %.lo,$^) $(library) $(link) -rpath $(libdir)
9c60689e
DWT
206 $(ldid) $@
207
a7f2d052
DWT
208cycript: Console.lo libcycript.la $(inject)
209 $(libtool) --mode=link $(cxx) $(ldflags) -o $@ $(filter %.lo,$^) libcycript.la $(link) -rpath $(libdir)
9c60689e
DWT
210 $(entitle) cycript
211
212package: $(deb)
213
a7f2d052
DWT
214test: cycript
215 if [[ -e target.cy ]]; then ./cycript -c target.cy && echo; fi
216 if [[ -e jquery.js ]]; then $(time) ./cycript -c jquery.js >jquery.cyc.js; gzip -9c jquery.cyc.js >jquery.cyc.js.gz; wc -c jquery.{mam,gcc,cyc,bak,yui}.js; wc -c jquery.{cyc,gcc,bak,mam,yui}.js.gz; fi
217 if [[ -e test.cy ]]; then ./cycript test.cy; fi
9c60689e 218
a7f2d052 219install: cycript libcycript.la
af896e32 220 $(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)
a7f2d052
DWT
221 $(libtool) --mode=install $(INSTALL_PROGRAM) libcycript.la $(DESTDIR)$(libdir)/libcycript.la
222 $(libtool) --mode=install $(INSTALL_PROGRAM) cycript $(DESTDIR)$(bindir)/cycript
9c60689e 223
a7f2d052
DWT
224uninstall:
225 $(libtool) --mode=uninstall rm -f $(DESTDIR)$(bindir)/cycript
226 $(libtool) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libcycript.la
227
228.PHONY: all clean extra install uninstall package test control.tmp