[Synopsis-cvs] Synopsis/Synopsis/Synopsis/Parser/C++ configure.ac,1.1,1.2 Makefile.in,1.1,1.2

Stefan Seefeld stefan at frida.spi-inc.org
Wed Sep 17 21:11:03 UTC 2003


Update of /cvs/synopsis/Synopsis/Synopsis/Parser/C++
In directory frida:/tmp/cvs-serv13145/Synopsis/Parser/C++

Modified Files:
	configure.ac Makefile.in 
Log Message:
C++ and C parser modules now compile via 'python setup.py build_ext'.

Index: configure.ac
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/C++/configure.ac,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -d -r1.1 -r1.2
--- configure.ac	18 Sep 2003 02:54:14 -0000	1.1
+++ configure.ac	18 Sep 2003 04:10:05 -0000	1.2
@@ -48,10 +48,36 @@ PYTHON_INCLUDE=`$PYTHON -c "from distuti
 AC_SUBST(PYTHON)
 AC_SUBST(PYTHON_INCLUDE)
 
+AC_ARG_ENABLE([gc], 
+    [  --disable-gc            don't use garbage collector in C++ parser (default is enabled)],
+    [USE_GC=no],[USE_GC=yes])
+
+AC_SUBST(USE_GC)
+
+dnl check for libdl
+AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"])
+
+dnl Check host for things like -fPIC and library extension
+AC_MSG_CHECKING([for library file extension])
+cpp_profile=""
+case `uname -s` in
+CYGWIN*)
+    LIBEXT=dll
+    ;;
+*)
+    CXXFLAGS="$CXXFLAGS -fPIC"
+    LIBEXT=so
+    ;;
+esac
+AC_MSG_RESULT([$LIBEXT])
+
+AC_SUBST(LIBEXT)
+
 AC_CONFIG_FILES([Makefile])
 
 #temporary hack until the file layout can be reworked a bit...
-mkdir -p ../occ
-mkdir -p ../ucpp
+mkdir -p ucpp
+mkdir -p occ
+mkdir -p syn
 
 AC_OUTPUT

Index: Makefile.in
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Parser/C++/Makefile.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -d -r1.1 -r1.2
--- Makefile.in	18 Sep 2003 02:54:14 -0000	1.1
+++ Makefile.in	18 Sep 2003 04:10:05 -0000	1.2
@@ -20,4 +20,137 @@
 
 SHELL	= /bin/sh
 
-dummy:
\ No newline at end of file
+srcdir	:= @srcdir@
+
+PYTHON	:= @PYTHON@
+
+CC		:= @CC@
+CXX		:= @CXX@
+MAKEDEP		:= $(CXX) -M
+CPPFLAGS	:= @CPPFLAGS@ -I $(srcdir) -I @PYTHON_INCLUDE@
+CFLAGS		:= @CFLAGS@
+CXXFLAGS	:= @CXXFLAGS@
+LIBS		:= @LIBS@ -lpthread
+LIBRARY_EXT	:= @LIBEXT@
+
+USE_GC		:= @USE_GC@
+
+ifeq ($(USE_GC), yes)
+GC_LIB		:= gc/.libs/libgc.a
+else
+CPPFLAGS	+= -DDONT_GC
+endif
+
+UCPP_FLAGS	:= -DSYNOPSIS -DSTAND_ALONE -DAUDIT -DMEM_CHECK
+UCPP_AFLAGS	:= -DSTAND_ALONE -DAUDIT -DMEM_CHECK
+
+UCPP_LIB	:= ucpp/ucpp.a
+UCPP_GLIB	:= ucpp/ucpp.ga
+OCC_SO		:= occ.$(LIBRARY_EXT)
+LINK_SO		:= link.$(LIBRARY_EXT)
+
+OCC_FILES	:= buffer hash token ptree ptree-core encoding env \
+		   pattern walker typeinfo parse mop classwalk \
+		   metaclass quote-class member cbodywalk
+
+SYN_FILES	:= synopsis occ swalker ast builder type dict \
+		   dumper decoder swalker-syntax link_map linkstore \
+		   lookup filter
+
+UCPP_FILES	:= mem hashtable cpp lexer assert macro eval
+
+# Generate sources, objs and debug-objs from the FILES
+OCC_SOURCES	:= $(patsubst %, occ/%.cc, $(OCC_FILES))
+OCC_OBJ		:= $(patsubst %, occ/%.o, $(OCC_FILES))
+OCC_GOBJ	:= $(patsubst %, occ/%.go,$(OCC_FILES))
+SYN_SOURCES	:= $(patsubst %, syn/%.cc, $(SYN_FILES))
+SYN_OBJ		:= $(patsubst %, syn/%.o, $(SYN_FILES))
+SYN_GOBJ	:= $(patsubst %, syn/%.go,$(SYN_FILES))
+UCPP_SOURCES	:= $(patsubst %, ucpp/%.c, $(UCPP_FILES))
+UCPP_OBJ	:= $(patsubst %, ucpp/%.o, $(UCPP_FILES))
+UCPP_GOBJ	:= $(patsubst %, ucpp/%.go,$(UCPP_FILES))
+UCPP_AOBJ	:= $(patsubst %, ucpp/%.ao,$(UCPP_FILES))
+
+TARGETS		= $(OCC_SO) $(LINK_SO)
+
+vpath %.cc $(srcdir)
+vpath %.c $(srcdir)
+vpath %.h $(srcdir)
+
+all: $(TARGETS)
+
+# This compiles the OCC files in the parent dir
+$(OCC_OBJ): %.o : %.cc
+	$(CXX)  $(CPPFLAGS) -I$(srcdir)/gc/include -I$(srcdir)/occ $(CXXFLAGS) $(OPTIMISE) -c -o $@ $<
+
+# This compiles the parser files with optimisation
+$(SYN_OBJ): %.o : %.cc
+	$(CXX) $(CPPFLAGS) -I$(srcdir)/gc/include $(SYN_FLAGS) $(CXXFLAGS) $(OPTIMISE) -c -o $@ $<
+
+# This compiles the UCPP files from ../ucpp
+$(UCPP_OBJ): %.o : %.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(UCPP_FLAGS) $(OPTIMISE) -c -o $@ $<
+
+# This compiles DEBUG versions of the OCC files in the parent dir
+$(OCC_GOBJ): %.go : %.cc
+	$(CXX) $(CPPFLAGS) -I$(srcdir)/gc/include -I$(srcdir)/occ $(CXXFLAGS) $(DEBUG) -c -o $@ $<
+
+# This compiles DEBUG versions of the object files with .go suffix
+$(SYN_GOBJ): %.go : %.cc
+	$(CXX) $(CPPFLAGS) -I$(srcdir)/gc/include $(SYN_FLAGS) $(CXXFLAGS) $(DEBUG) -c -o $@ $<
+
+# This compiles DEBUG versions of the UCPP files
+$(UCPP_GOBJ): %.go : %.c
+	$(CC) $(CPPFLAGS) $(UCPP_FLAGS) $(CFLAGS) $(DEBUG) -c -o $@ $<
+
+# This compiles STANDALONE versions of the UCPP files
+$(UCPP_AOBJ): %.ao : %.c
+	$(CC) $(CPPFLAGS) $(UCPP_AFLAGS) $(CFLAGS) $(DEBUG) -c -o $@ $<
+
+link-synopsis:	$(srcdir)/syn/link.cc
+	$(CXX) $(CPPFLAGS) -DSTANDALONE $(CXXFLAGS) $(DEBUG) $(SYN_FLAGS) -o link-synopsis link.cc
+
+ucpp:		$(UCPP_AOBJ)
+	$(CC) -o $@ $^
+
+# This calls make in the gc dir to create the gc.a file
+$(GC_LIB):
+	@make -C gc
+
+# This creates the final occ python module
+$(OCC_SO): $(UCPP_LIB) opencxx.a $(SYN_OBJ)
+	$(CXX) -shared $(LDFLAGS) -o $@ $^ $(LIBS)
+
+# This creates the final link python module
+$(LINK_SO): $(srcdir)/syn/link.cc
+	$(CXX) -shared $(CPPFLAGS) $(SYN_FLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+# This creates a binary with debugging and profiling that you can run
+occ.gdb: $(UCPP_GLIB) opencxx.ga $(SYN_GOBJ)
+	$(CXX) -ggdb -pg $(LDFLAGS) -o $@ $^ $(LIBS) $(PYLIB)
+
+# Compile an archive of the OCC files
+opencxx.a : $(GC_LIB) $(OCC_OBJ)
+ifeq '$(use_gc)' 'yes'
+	cp $(GC_LIB) $@
+endif
+	ar rcs $@ $(OCC_OBJ)
+
+# Compile a DEBUG archive of the OCC files
+opencxx.ga :  $(GC_LIB) $(OCC_GOBJ)
+ifeq ($(USE_GC), yes)
+	cp $(GC_LIB) $@
+endif
+	ar rcs $@ $(OCC_GOBJ)
+
+# Compile an archive of UCPP files
+$(UCPP_LIB): $(UCPP_OBJ)
+	ar rcs $@ $^
+
+# Compile a DEBUG archive of UCPP files
+$(UCPP_GLIB): $(UCPP_GOBJ)
+	ar rcs $@ $^
+
+clean :
+
+distclean: clean





More information about the Synopsis-changes mailing list