+# @configure_input@
+
SHELL := @_BASH@
VPATH := @srcdir@
libtool := @LIBTOOL@
cxx := @CXX@
objcxx := @OBJCXX@
-flags := @CPPFLAGS@ @CXXFLAGS@ -DYYDEBUG=1
+cflags := @CPPFLAGS@ @CXXFLAGS@ -DYYDEBUG=1 @DEFS@
+objcxxflags := @OBJCXXFLAGS@
+ldflags := @LDFLAGS@
+library := @LIBS@ @LTLIBAPR@ @LTLIBICONV@
+time := $(shell which @TIME@)
+gperf := @GPERF@
+
+INSTALL := @INSTALL@
+INSTALL_PROGRAM := @INSTALL_PROGRAM@
+INSTALL_DATA := @INSTALL_DATA@
+
+PACKAGE_TARNAME := @PACKAGE_TARNAME@
+prefix := @prefix@
+exec_prefix := @exec_prefix@
+bindir := @bindir@
+sbindir := @sbindir@
+libexecdir := @libexecdir@
+datarootdir := @datarootdir@
+datadir := @datadir@
+sysconfdir := @sysconfdir@
+sharedstatedir := @sharedstatedir@
+localstatedir := @localstatedir@
+includedir := @includedir@
+oldincludedir := @oldincludedir@
+docdir := @docdir@
+infodir := @infodir@
+htmldir := @htmldir@
+dvidir := @dvidir@
+pdfdir := @pdfdir@
+psdir := @psdir@
+libdir := @libdir@
+localedir := @localedir@
+mandir := @mandir@
+
+CY_EXECUTE := @CY_EXECUTE@
+CY_OBJECTIVEC := @CY_OBJECTIVEC@
paths := $(foreach path,$(paths),$(wildcard $(path)))
-flags += $(foreach path,$(paths),-I$(path) -L$(path))
+cflags += $(foreach path,$(paths),-I$(path) -L$(path))
-svn := $(shell svnversion)
+svn := $(shell svnversion $(srcdir))
all:
all := cycript
header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp Internal.hpp Error.hpp String.hpp Exception.hpp Standard.hpp
code :=
-code += Replace.o Output.o
-code += Cycript.tab.o lex.cy.o
-code += Network.o Parser.o
-code += JavaScriptCore.o Library.o
+code += Replace.lo Output.lo
+code += Cycript.tab.lo lex.cy.lo
+code += Network.lo Parser.lo
+code += JavaScriptCore.lo Library.lo
inject :=
entitle := $(ldid)
lib := lib
dll := so
-apr_config := apr-1-config
-library :=
-console := -lreadline
depends :=
restart ?= $(MAKE)
uname_s ?= $(shell uname -s)
uname_p ?= $(shell uname -p)
--include $(uname_s).mk
--include $(uname_s)-$(uname_p).mk
-
-ifneq ($(shell pkg-config libffi --modversion 2>/dev/null),)
-flags += $(shell pkg-config --cflags libffi)
+ifeq ($(CY_EXECUTE),1)
+cflags += -DCY_EXECUTE
+code += sig/ffi_type.lo sig/parse.lo sig/copy.lo
+code += Execute.lo Bridge.lo
+filters += C
+#ifeq ($(filter ObjectiveC,$(filters)),)
+#ifneq ($(shell which gnustep-config 2>/dev/null),)
+#include GNUstep.mk
+#endif
+#endif
endif
-ifdef CY_EXECUTE
-ifeq ($(filter ObjectiveC,$(filters)),)
-ifneq ($(shell which gnustep-config 2>/dev/null),)
-include GNUstep.mk
-endif
-endif
-endif
-
-apr := $(shell $(apr_config) --link-ld)
-library += $(apr)
-console += $(apr)
-
-flags += -Wall -Werror -Wno-parentheses #-Wno-unused
-flags += -fno-common
+cflags += -Wall -Werror -Wno-parentheses #-Wno-unused
+cflags += -fno-common
ifneq ($(srcdir),.)
-flags += -I.
+cflags += -I.
endif
-flags += -I$(srcdir) -I$(srcdir)/include -I$(shell $(apr_config) --includedir)
+cflags += -I$(srcdir) -I$(srcdir)/include
-all += $(lib)cycript.$(dll)
+all += libcycript.la
filters += $(shell bison <(echo '%code{}%%_:') -o/dev/null 2>/dev/null && echo Bison24 || echo Bison23)
dpkg-deb -b package $(deb)
endif
+ifeq ($(CY_EXECUTE),1)
+Bridge.gperf: Bridge.def Bridge.sh
+ $(srcdir)/Bridge.sh $< >$@
+
+Bridge.hpp: Bridge.gperf
+ $(gperf) $< | sed -e 's/defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__/0/' >$@
+
+Bridge.lo: Bridge.hpp
+endif
+
+ifeq ($(CY_OBJECTIVEC),1)
+filters += ObjectiveC
+header += Struct.hpp ObjectiveC/Internal.hpp ObjectiveC/Syntax.hpp
+code += ObjectiveC/Output.lo ObjectiveC/Replace.lo ObjectiveC/Library.lo
+
+Struct.hpp:
+ $$($(objcxx) -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
+endif
+
all: $(all)
clean::
- rm -f *.lo *.o $(lib)cycript.$(dll) $(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.hpp Cycript.output
+ 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
+ifneq ($(srcdir),.)
+ rm -rf sig ObjectiveC
+endif
distclean: clean
rm -f GNUmakefile config.log config.status libtool
#Parser.hpp: Parser.py Parser.dat
# ./Parser.py <Parser.dat >$@
-Cycript.tab.o: Cycript.tab.cc $(header)
- $(libtool) --mode=compile $(cxx) $(flags) -c -o $@ $<
+Cycript.tab.lo: Cycript.tab.cc $(header)
+ $(libtool) --mode=compile $(cxx) $(cflags) -c -o $@ $<
-lex.cy.o: lex.cy.c $(header)
- $(libtool) --mode=compile $(cxx) $(flags) -c -o $@ $<
+lex.cy.lo: lex.cy.c $(header)
+ $(libtool) --mode=compile $(cxx) $(cflags) -c -o $@ $<
-%.o: %.cpp $(header)
- $(libtool) --mode=compile $(cxx) $(flags) -c -o $@ $<
+%.lo: %.cpp $(header)
+ $(libtool) --mode=compile $(cxx) $(cflags) -c -o $@ $<
-%.o: %.mm $(header)
- $(libtool) --mode=compile $(objcxx) $(flags) -c -o $@ $<
+%.lo: %.mm $(header)
+ $(libtool) --mode=compile $(objcxx) $(objcxxflags) $(cflags) -c -o $@ $<
-$(lib)cycript.$(dll): $(code)
- $(libtool) --mode=link $(cxx) $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library) $(link)
+libcycript.la: $(code)
+ $(libtool) --mode=link $(cxx) $(ldflags) -o $@ $(filter %.lo,$^) $(library) $(link) -rpath $(libdir)
$(ldid) $@
-cycript: Console.o $(lib)cycript.$(dll) $(inject)
- $(libtool) --mode=link $(cxx) $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(console) $(link)
+cycript: Console.lo libcycript.la $(inject)
+ $(libtool) --mode=link $(cxx) $(ldflags) -o $@ $(filter %.lo,$^) libcycript.la $(link) -rpath $(libdir)
$(entitle) cycript
package: $(deb)
-test: $(deb)
- dpkg -i $(deb)
- if [[ -e target.cy ]]; then cycript -c target.cy && echo; fi
- if [[ -e jquery.js ]]; then /usr/bin/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
- if [[ -e test.cy ]]; then cycript test.cy; fi
+test: cycript
+ if [[ -e target.cy ]]; then ./cycript -c target.cy && echo; fi
+ 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
+ if [[ -e test.cy ]]; then ./cycript test.cy; fi
+
+install: cycript libcycript.la
+ $(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)
+ $(libtool) --mode=install $(INSTALL_PROGRAM) libcycript.la $(DESTDIR)$(libdir)/libcycript.la
+ $(libtool) --mode=install $(INSTALL_PROGRAM) cycript $(DESTDIR)$(bindir)/cycript
-install: cycript $(lib)cycript.$(dll)
- cp -p cycript /usr/bin
- cp -p $(lib)cycript.$(dll) /usr/lib
+uninstall:
+ $(libtool) --mode=uninstall rm -f $(DESTDIR)$(bindir)/cycript
+ $(libtool) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libcycript.la
-.PHONY: all clean extra package control.tmp
+.PHONY: all clean extra install uninstall package test control.tmp