diff --git a/Makefile b/Makefile index 8dab9240..84e1bd02 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,12 @@ -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// +-include Makefile.header +###################################### # High level rules - -all : SAX, examples - -SAX: dummy +all : cd SAX; ${MAKE} - -examples: dummy cd examples; ${MAKE} -# Cleaning up - clean : cd SAX; ${MAKE} clean cd examples; ${MAKE} clean @@ -29,8 +22,10 @@ tar: clean zip: clean cd ..; zip -rv9 arabica/arabica.zip arabica -x arabica/arabica.tar.gz -x \*/CVS/\* -dummy: + #///////////////////////////////////////////////////////////////////////// #////////////////////////////////////////////// # End of File + + diff --git a/Makefile.header b/Makefile.header new file mode 100644 index 00000000..1be7038a --- /dev/null +++ b/Makefile.header @@ -0,0 +1,44 @@ +#################################### +# ARABICA CONFIG +# edit for your parser choice - may include more than one USE_* +PARSER_CONFIG = -DUSE_EXPAT +#PARSER_CONFIG = -DUSE_EXPAT -DUSE_LIBXML2 -DUSE_XERCES -DUSE_GARDEN + +#################################### +# TOOLS +##### +MAKE = make +# C++ compiler +CXX = gcc +# preprocessor +CPP = gcc -E +# linker +LD = gcc +# archiver +AR = ar r + +########### +# Utilities +REMOVE = rm -rf +LINK = ln -sf +COPY = cp -f + +###################################### +# BUILD FLAGS +# you probably want to set some these according to +# your parser choice +# eg DYNAMIC_LIBS = -lexpat + +CXXFLAGS = -Wall +LDFLAGS = + +# Includes and library directories +INCS_DIRS = -I.. +LIBS_DIRS = + +STATIC_LIBS = +DYNAMIC_LIBS = -lexpat -lstdc++ + + + + diff --git a/SAX/Makefile b/SAX/Makefile index a77c9b2a..9ae471e8 100644 --- a/SAX/Makefile +++ b/SAX/Makefile @@ -9,47 +9,20 @@ # $Id$ #################################### - -#################################### -# ARABICA CONFIG -# edit for your parser choice - may include more than one USE_* -PARSER_CONFIG = -DUSE_EXPAT -DARABICA_NO_WCHAR_T -#PARSER_CONFIG = -DUSE_EXPAT -DUSE_LIBXML2 -DUSE_XERCES -DUSE_GARDEN - -#################################### -# TOOLS -##### -# C++ compiler -CXX = gcc -# preprocessor -CPP = gcc -E -# linker -LD = gcc -# archiver -AR = ar r - -########### -# Utilities -REMOVE = rm -rf -LINK = ln -sf -COPY = cp -f +-include ../Makefile.header ###################################### -# BUILD FLAGS -CXXFLAGS += -Wall +# ADDITIONAL BUILD FLAGS +CXXFLAGS += LDFLAGS += -shared -# Uncomment for optimisations -CXXFLAGS += -O2 -LDFLAGS += +INC_DIRS += +LIBS_DIRS += -# Includes and library directories -INCS_DIRS = -I.. -LIBS_DIRS = - -STATIC_LIBS = -DYNAMIC_LIBS = +STATIC_LIBS += +DYNAMIC_LIBS += +############ CXXFLAGS += $(INCS_DIRS) LDFLAGS += $(LIBS_DIRS) LDFLAGS += $(STATIC_LIBS) @@ -59,18 +32,19 @@ LDFLAGS += $(DYNAMIC_LIBS) # SOURCE FILES SRCS = saxlib.cpp \ helpers/InputSourceResolver.cpp \ - ../Utils/base64codecvt.cpp \ - ../Utils/iso88591utf8codecvt.cpp \ - ../Utils/rot13codecvt.cpp \ - ../Utils/utf16beucs2codecvt.cpp \ - ../Utils/utf16leucs2codecvt.cpp \ - ../Utils/utf16utf8codecvt.cpp \ - ../Utils/utf8iso88591codecvt.cpp \ ../Utils/utf8ucs2codecvt.cpp \ - ../Utils/impl/iso88591_utf8.cpp \ - ../Utils/impl/ucs2_utf16.cpp \ ../Utils/impl/ucs2_utf8.cpp \ ../XML/XMLCharacterClasses.cpp +# ../Utils/base64codecvt.cpp \ +# ../Utils/iso88591utf8codecvt.cpp \ +# ../Utils/rot13codecvt.cpp \ +# ../Utils/utf16beucs2codecvt.cpp \ +# ../Utils/utf16leucs2codecvt.cpp \ +# ../Utils/utf16utf8codecvt.cpp \ +# ../Utils/utf8iso88591codecvt.cpp \ +# ../Utils/impl/iso88591_utf8.cpp \ +# ../Utils/impl/ucs2_utf16.cpp \ + HDRS = $(patsubst %.c,%.h,$(patsubst %.cpp,%.h,$(SRCS))) OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SRCS))) diff --git a/examples/Makefile b/examples/Makefile index 3eb93aa0..875acfad 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,9 +1,6 @@ - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// +-include Makefile.header # High level rules - all : cd SAX; ${MAKE} cd SAX2DOM; ${MAKE} @@ -16,8 +13,4 @@ clean : cd SAX2DOM; ${MAKE} clean cd Utils; ${MAKE} clean - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - # End of File diff --git a/examples/SAX/Makefile b/examples/SAX/Makefile index 601a9b6a..48b1765c 100644 --- a/examples/SAX/Makefile +++ b/examples/SAX/Makefile @@ -1,67 +1,22 @@ -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// -# Utilities +-include ../../Makefile.header -REMOVE = rm -rf -LINK = ln -sf +###################################### +# ADDITIONAL BUILD FLAGS +INCS_DIRS += -I../.. +LIBS_DIRS += -L../../bin -# For GNU make: -OS_VER := $(shell uname -s | sed -e s/\[\.\ \]/_/g) -# For other make (like Sun's) you can try: -# OS_VER:sh =uname -sr | sed -e s/\[\.\ \]/_/g +STATIC_LIBS += +DYNAMIC_LIBS += -lArabica -# C/C++ shortcuts -CXX = c++ - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// -# Compile and link flags... -# -# -c Produce object code. -# -Wall Max warning level. -# -Werror Treat warnings as errors. -# -O2 Turn on medium optimisations. -# -g Add debug information. -# -D Define symbolic constant. -# -fPIC Generate position independent code. -# -shared Produce a sharable object. -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - -ifeq ($(OS_VER),SunOS) -CXXFLAGS = -Wall -pthreads -fpic -else -CXXFLAGS = -Wall -endif - -LDFLAGS = -CCDEPFLAGS = -E -M - -# Uncomment for optimisations -CXXFLAGS += -O2 -LDFLAGS += -O2 - -# Uncomment for debug version -# CXXFLAGS += -g -D__DEBUG__ - - -# Includes and library directories -INCS_DIRS = -I../.. -#INCS_DIRS = -I.. - -LIBS_DIRS = -L../../bin - -STATIC_LIBS = -DYNAMIC_LIBS = -lArabica -lexpat - -CXXFLAGS += ${INCS_DIRS} -LDFLAGS += ${LIBS_DIRS} -LDFLAGS += ${DYNAMIC_LIBS} - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// +############ +CXXFLAGS += $(INCS_DIRS) +LDFLAGS += $(LIBS_DIRS) +LDFLAGS += $(STATIC_LIBS) +LDFLAGS += $(DYNAMIC_LIBS) +###################################### +# SOURCE FILES PYX_SRCS = pyx.cpp PYX_HDRS = $(patsubst %.c,%.h,$(patsubst %.cpp,%.h,$(PYX_SRCS))) PYX_OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(PYX_SRCS))) @@ -74,58 +29,31 @@ WRITER_SRCS = writer.cpp WRITER_HDRS = $(patsubst %.c,%.h,$(patsubst %.cpp,%.h,$(WRITER_SRCS))) WRITER_OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(WRITER_SRCS))) - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - +###################################### # High level rules - all : pyx simple_handler writer pyx : $(PYX_OBJS) - $(LINK.cc) -o $@ $(PYX_OBJS) - cp pyx ../../bin + $(LD) $(LDFLAGS) -o $@ $(PYX_OBJS) + $(COPY) pyx ../../bin simple_handler : $(SIMPLE_OBJS) - $(LINK.cc) -o $@ $(SIMPLE_OBJS) - cp simple_handler ../../bin + $(LD) $(LDFLAGS) -o $@ $(SIMPLE_OBJS) + $(COPY) simple_handler ../../bin writer : $(WRITER_OBJS) - $(LINK.cc) -o $@ $(WRITER_OBJS) - cp writer ../../bin - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// + $(LD) $(LDFLAGS) -o $@ $(WRITER_OBJS) + $(COPY) writer ../../bin +###################### # Compile rules - +#### %.o : %.cpp - $(COMPILE.cc) -o $@ $< - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - -# Dependencies - -depend : .depend - -.depend :: - $(COMPILE.cc) $(CCDEPFLAGS) ${PYX_SRCS} $(WRITER_SRCS) ${SIMPLE_SRCS} > .depend - --include .depend - - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// + $(CXX) $(CXXFLAGS) -c -o $@ $< +###################### # Cleaning up - clean : - $(REMOVE) .depend *.o core pyx writer simple_handler ../../bin/pyx ../../bin/writer ../../bin/simple_handler - - - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// + $(REMOVE) *.o core pyx writer simple_handler ../../bin/pyx ../../bin/writer ../../bin/simple_handler # End of File diff --git a/examples/SAX2DOM/Makefile b/examples/SAX2DOM/Makefile index 4b53a2e4..b012b9c9 100644 --- a/examples/SAX2DOM/Makefile +++ b/examples/SAX2DOM/Makefile @@ -1,68 +1,22 @@ -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// -# Utilities +-include ../../Makefile.header -REMOVE = rm -rf -LINK = ln -sf +###################################### +# ADDITIONAL BUILD FLAGS +INCS_DIRS += -I../.. +LIBS_DIRS += -L../../bin -# For GNU make: -OS_VER := $(shell uname -s | sed -e s/\[\.\ \]/_/g) -# For other make (like Sun's) you can try: -# OS_VER:sh =uname -sr | sed -e s/\[\.\ \]/_/g +STATIC_LIBS += +DYNAMIC_LIBS += -lArabica -# C/C++ shortcuts -CXX = c++ +############ +CXXFLAGS += $(INCS_DIRS) +LDFLAGS += $(LIBS_DIRS) +LDFLAGS += $(STATIC_LIBS) +LDFLAGS += $(DYNAMIC_LIBS) -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// -# Compile and link flags... -# -# -c Produce object code. -# -Wall Max warning level. -# -Werror Treat warnings as errors. -# -O2 Turn on medium optimisations. -# -g Add debug information. -# -D Define symbolic constant. -# -fPIC Generate position independent code. -# -shared Produce a sharable object. -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - -ifeq ($(OS_VER),SunOS) -CXXFLAGS = -Wall -pthreads -fpic -else -CXXFLAGS = -Wall -endif - -LDFLAGS = -CCDEPFLAGS = -E -M - -# Uncomment for optimisations -CXXFLAGS += -O2 -LDFLAGS += -O2 -L../../bin - -# Uncomment for debug version -CXXFLAGS += -g - - -# Includes and library directories -INCS_DIRS = -I../.. -#INCS_DIRS = -I.. - -LIBS_DIRS = -L../../bin - -STATIC_LIBS = -DYNAMIC_LIBS = -lArabica -lstdc++ - -CXXFLAGS += ${INCS_DIRS} -LDFLAGS += ${LIBS_DIRS} -LDFLAGS += ${DYNAMIC_LIBS} - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - -# Source files +###################################### +# SOURCE FILES SAXDOM_SRCS = main.cpp test_Attribute.cpp test_Document.cpp test_DocumentFragment.cpp test_DocumentType.cpp test_DOMImplementation.cpp test_Element.cpp test_ProcessingInstruction.cpp test_Siblings.cpp test_SAX.cpp SAXDOM_HDRS = $(patsubst %.cpp,%.h,$(SAXDOM_SRCS)) SAXDOM_OBJS = $(patsubst %.cpp,%.o,$(SAXDOM_SRCS)) @@ -79,53 +33,27 @@ DOMWRITER_SRCS = DOMWriter.cpp DOMWRITER_HDRS = $(patsubst %.c,%.h,$(patsubst %.cpp,%.h,$(DOMWRITER_SRCS))) DOMWRITER_OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(DOMWRITER_SRCS))) -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - +###################################### # High level rules - all : sax2dom_test domwriter - sax2dom_test : $(SAXDOM_OBJS) $(CPPUNITFW_OBJS) $(CPPUNITUI_OBJS) - $(LINK.cc) -o $@ $(SAXDOM_OBJS) $(CPPUNITFW_OBJS) $(CPPUNITUI_OBJS) - cp sax2dom_test ../../bin + $(LD) $(LDFLAGS) -o $@ $(SAXDOM_OBJS) $(CPPUNITFW_OBJS) $(CPPUNITUI_OBJS) + $(COPY) sax2dom_test ../../bin domwriter : $(DOMWRITER_OBJS) - $(LINK.cc) -o $@ $(DOMWRITER_OBJS) - cp domwriter ../../bin - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// + $(LD) $(LDFLAGS) -o $@ $(DOMWRITER_OBJS) + $(COPY) domwriter ../../bin +###################### # Compile rules - +#### %.o : %.cpp - $(COMPILE.cc) -o $@ $< - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - -# Dependencies - -depend : .depend - -.depend :: - $(COMPILE.cc) $(CCDEPFLAGS) $(SAXDOM_SRCS) $(CPPUNITFW_SRCS) $(CPPUNITUI_SRCS) > .depend - --include .depend - - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// + $(CXX) $(CXXFLAGS) -c -o $@ $< +###################### # Cleaning up - clean : - $(REMOVE) .depend $(CPPUNITUI_OBJS) $(CPPUNITFW_OBJS) $(SAXDOM_OBJS) $(DOMWRITER_OBJS) core sax2dom_test domwriter ../../bin/sax2dom_test ../../bin/domwriter - - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// + $(REMOVE) $(CPPUNITUI_OBJS) $(CPPUNITFW_OBJS) $(SAXDOM_OBJS) $(DOMWRITER_OBJS) core sax2dom_test domwriter ../../bin/sax2dom_test ../../bin/domwriter # End of File diff --git a/examples/Utils/Makefile b/examples/Utils/Makefile index 08fd0acf..71ba2686 100644 --- a/examples/Utils/Makefile +++ b/examples/Utils/Makefile @@ -1,115 +1,46 @@ -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// -# Utilities +-include ../../Makefile.header -REMOVE = rm -rf -LINK = ln -sf +###################################### +# ADDITIONAL BUILD FLAGS +INCS_DIRS += -I../.. +LIBS_DIRS += -L../../bin -# For GNU make: -OS_VER := $(shell uname -s | sed -e s/\[\.\ \]/_/g) -# For other make (like Sun's) you can try: -# OS_VER:sh =uname -sr | sed -e s/\[\.\ \]/_/g +STATIC_LIBS += +DYNAMIC_LIBS += -lArabica -# C/C++ shortcuts -CXX = c++ - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// -# Compile and link flags... -# -# -c Produce object code. -# -Wall Max warning level. -# -Werror Treat warnings as errors. -# -O2 Turn on medium optimisations. -# -g Add debug information. -# -D Define symbolic constant. -# -fPIC Generate position independent code. -# -shared Produce a sharable object. -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - -ifeq ($(OS_VER),SunOS) -CXXFLAGS = -Wall -pthreads -fpic -else -CXXFLAGS = -Wall -endif - -LDFLAGS = -CCDEPFLAGS = -E -M - -# Uncomment for optimisations -CXXFLAGS += -O2 -LDFLAGS += -O2 - -# Uncomment for debug version -# CXXFLAGS += -g - - -# Includes and library directories -INCS_DIRS = -I../.. -#INCS_DIRS = -I.. - -LIBS_DIRS = -L../../bin - -STATIC_LIBS = -DYNAMIC_LIBS = -lArabica - -CXXFLAGS += ${INCS_DIRS} -LDFLAGS += ${LIBS_DIRS} -LDFLAGS += ${DYNAMIC_LIBS} - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// +############ +CXXFLAGS += $(INCS_DIRS) +LDFLAGS += $(LIBS_DIRS) +LDFLAGS += $(STATIC_LIBS) +LDFLAGS += $(DYNAMIC_LIBS) +###################################### +# SOURCE FILES TRANSCODE_SRCS = transcode.cpp TRANSCODE_HDRS = $(patsubst %.c,%.h,$(patsubst %.cpp,%.h,$(TRANSCODE_SRCS))) TRANSCODE_OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(TRANSCODE_SRCS))) -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - +###################################### # High level rules - all : transcode transcode : $(TRANSCODE_OBJS) - $(LINK.cc) -o $@ $(TRANSCODE_OBJS) - cp transcode ../../bin + $(LD) $(LDFLAGS) -o $@ $(TRANSCODE_OBJS) + $(COPY) transcode ../../bin -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// +###################### # Compile rules - +#### %.o : %.cpp - $(COMPILE.cc) -o $@ $< - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// - -# Dependencies - -depend : .depend - -.depend :: - $(COMPILE.cc) $(CCDEPFLAGS) ${PYX_SRCS} $(WRITER_SRCS) ${SIMPLE_SRCS} > .depend - --include .depend - - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// + $(CXX) $(CXXFLAGS) -c -o $@ $< +###################### # Cleaning up clean : - $(REMOVE) .depend *.o core transcode ../../bin/transcode - - - -#///////////////////////////////////////////////////////////////////////// -#////////////////////////////////////////////// + $(REMOVE) $(TRANSCODE_OBJS) core transcode ../../bin/transcode # End of File