######################################## # Makefile for zinclib # ######################################## # default all: zinclib ###################################################################### # IntuiKit common Makefile # # # # This software is the property of IntuiLab SA, France. # # # # Contributors: # # Benoit Peccatte # # # ###################################################################### ## remove when no more in development DEBUG :=1 ################################## # Default GNU compilation options ################################## CXX := g++ GCC := g++ LIBEXT := .so EXE := DELFILES := PROFILE = MACRO = LIBDIR = ./lib INCLUDE = -isystem ./include LDFLAGS = $(PROFILE) -L$(LIBDIR) CXXFLAGS = -Wall -fpermissive $(MACRO) $(PROFILE) $(INCLUDE) INCLUDES = -fno-rtti LIBLDFLAGS = -shared $(LDFLAGS) -Wl,-export-dynamic LIBCXXFLAGS = -fPIC $(CXXFLAGS) ################################### # Automatic architecture detection ################################### ifndef ARCH ARCH := $(shell uname -s) endif # linux ifeq ($(ARCH),Linux) LIBEXT := .so MACRO += -DLINUX LDFLAGS += -ldl endif # MacOSX ifeq ($(ARCH),Darwin) LIBEXT := .dylib MACRO += -DMACOSX_BSD LDFLAGS += -ldl LIBLDFLAGS = -Wl,-single_module -dynamiclib $(LDFLAGS) endif # Windows cross compile ifeq ($(ARCH),win32) CXX := i386-mingw32msvc-g++ GCC := i386-mingw32msvc-gcc LIBEXT := .dll EXE := .exe MACRO += -DWIN32 LDFLAGS += -L$(EXPAT_HOME) endif # native windows 2K, XP ifeq ($(ARCH),MINGW32_NT-5.1) LIBEXT := .dll EXE := .exe MACRO += -DWIN32 endif ################### # Options handling ################### ##### DEBUG options ifdef DEBUG CXXFLAGS += -g endif ##### Profiling options ifdef PROF PROFILE = -pg -fprofile-arcs -ftest-coverage DELFILES += *.gcov *.bb *.bbg *.da gmon.out endif ##### Purify coverage options ifdef COV GCC := purecov $(GCC) DELFILES += *.pcv endif ##### Purify options ifdef PURIFY GCC := purify -view-file=pure.pv $(GCC) DELFILES += .pure* *_pure_* pure.pv endif ##### Options to display more warnings ifdef VERBOSE CXXFLAGS += -Wctor-dtor-privacy -Wnon-virtual-dtor CXXFLAGS += -Wold-style-cast -Woverloaded-virtual CXXFLAGS += -Wsign-promo -Wsynth -Wsynth -pedantic -Wchar-subscripts CXXFLAGS += -Wcomment -Wimplicit -Wmissing-braces -Wparentheses CXXFLAGS += -Wreturn-type -Wswitch -Wtrigraphs -Wunused CXXFLAGS += -Wreorder -Wunknown-pragmas -W -Wsign-compare CXXFLAGS += -Wfloat-equal -Wundef -Wlarger-than-1000 CXXFLAGS += -Wpointer-arith -Wcast-qual -Wcast-align CXXFLAGS += -Wstrict-prototypes -Wmissing-prototypes CXXFLAGS += -Wmissing-noreturn -Wmissing-format-attribute -Wpacked CXXFLAGS += -Wredundant-decls -Wunreachable-code -Winline CXXFLAGS += -Wdisabled-optimization -Wconversion -Wshadow CXXFLAGS += -O0 ifeq ($(VERBOSE),2) CXXFLAGS += -Wpadded -Wabi -Weffc++ -Waggregate-return -Wwrite-strings endif endif ##### Optimization options ifdef OPTIMIZE CXXFLAGS += -O$(OPTIMIZE) -Wuninitialized endif ######################################################### # END OF IntuiKit Common # ######################################################### # specific options LDFLAGS += -ltcl8.4 -ltk8.4 -lTkZinc # easy target zinclib: tmp/zinclib.o tmp/zinclib.o: tmp/ZincObjects.o tmp/ZincPath.o tmp/Zinc.o ld -r -o $@ $^ # generic target tmp/%.o: src/%.cpp @mkdir -p tmp $(CXX) $(LIBCXXFLAGS) -o $@ -c $< clean: rm -f tmp/*.o $(PROFFILES) # documentation doc: cd src; doxygen ../doxyConfig mkdir -p doc rm -rf doc/html mv src/docs/* doc rmdir src/docs # tests test: cd test; $(MAKE) cd test; ./runtests.sh .PHONY: test doc