SHELL=/bin/bash OPTFLAGS=-O2 -flto -g EXPORTFLAGS=-fvisibility=hidden -fpic -Wl,--export-dynamic CPPFLAGS=-std=gnu++11 -I../include -I../../include LIBSFLAGS= WARNFLAGS=-Wall CFLAGS=$(OPTFLAGS) $(EXPORTFLAGS) $(WARNFLAGS) $(CPPFLAGS) LDFLAGS=$(OPTFLAGS) $(EXPORTFLAGS) $(WARNFLAGS) $(LIBSFLAGS) CC=g++ ifdef MODULE -include makemod SOURCE = $(wildcard *.cpp) DEPENDS = $(subst .cpp,.d,$(SOURCE)) OBJECTS = $(subst .cpp,.o,$(SOURCE)) ../../bin/$(MODULE).so: $(OBJECTS) $(CC) -shared -o $@ $(OBJECTS) $(LDFLAGS) $(MODLIBS) %.o: %.cpp $(CC) -c $(CFLAGS) -o $@ $< %.d: %.cpp $(CC) $(CPPFLAGS) -MM -MT $(subst .cpp,.o,$<) $< | sed 's%\(^.*\):%\1 $@ :%g' >$@ include $(DEPENDS) clean: rm -f *.d *.o distclean: clean rm -f ../../bin/$(MODULE).so else MODDIRS = $(wildcard modules/*) MODDIRS+= $(wildcard extramodules/*) MODSOURCE = $(wildcard modules/*/*.cpp extramodules/*/*.cpp) MODHEADERS = $(wildcard modules/*/*.h extramodules/*/*.h) MODOBJECTS = $(subst .cpp,.o,$(MODSOURCE)) MODDEPS = $(subst .cpp,.d,$(MODSOURCE)) modules: $(MODSOURCE) $(MODHEADERS) for dir in $(MODDIRS); do\ make -C $$dir -f ../../Makefile MODULE=$${dir/*\//};\ done all: modules makemap makemap: $(MODOBJECTS) make -C src MODLIBS="$(MODLIBS)" MODOBJECTS="$(patsubst %,../%,$(MODOBJECTS))"; $(MODOBJECTS): $(MODSOURCE) $(MODHEADERS) for dir in $(MODDIRS); do\ make -C $$dir -f ../../Makefile MODULE=$${dir/*\//};\ done clean: for dir in $(MODDIRS); do\ make -C $$dir -f ../../Makefile MODULE=$${dir/*\//} clean;\ done make -C src clean distclean: for dir in $(MODDIRS); do\ make -C $$dir -f ../../Makefile MODULE=$${dir/*\//} distclean;\ done make -C src distclean -include $(wildcard modules/*/makemod) $(wildcard extramodules/*/makemod) endif