From 4463f6b69a401c6aca823ab3241199270cb013ec Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Fri, 18 Sep 2015 12:59:49 +1000 Subject: [PATCH] Make symlinks on all binary files in directory bin --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 30af73f..5656da5 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ SOURCE = $(wildcard *.cpp) DEPENDS = $(subst .cpp,.d,$(SOURCE)) OBJECTS = $(subst .cpp,.o,$(SOURCE)) -../../bin/$(MODULE).so: $(OBJECTS) +$(MODULE).so: $(OBJECTS) $(CC) -shared -o $@ $(OBJECTS) $(LDFLAGS) $(MODLIBS) %.o: %.cpp @@ -32,7 +32,7 @@ clean: rm -f *.d *.o distclean: clean - rm -f ../../bin/$(MODULE).so + rm -f $(MODULE).so else @@ -45,14 +45,17 @@ MODOBJECTS = $(subst .cpp,.o,$(MODSOURCE)) MODDEPS = $(subst .cpp,.d,$(MODSOURCE)) modules: $(MODSOURCE) $(MODHEADERS) + [ -d bin ] || mkdir bin for dir in $(MODDIRS); do\ - make -C $$dir -f ../../Makefile MODULE=$${dir/*\//};\ + mod=$${dir/*\//};\ + make -C $$dir -f ../../Makefile MODULE=$$mod && ln -sf ../$$dir/$${mod}.so bin/$${mod}.so;\ done all: modules makemap makemap: $(MODOBJECTS) - make -C src MODLIBS="$(MODLIBS)" MODOBJECTS="$(patsubst %,../%,$(MODOBJECTS))"; + [ -d bin ] || mkdir bin + make -C src MODLIBS="$(MODLIBS)" MODOBJECTS="$(patsubst %,../%,$(MODOBJECTS))" && ln -sf ../src/makemap bin/makemap $(MODOBJECTS): $(MODSOURCE) $(MODHEADERS) for dir in $(MODDIRS); do\ @@ -70,6 +73,8 @@ distclean: make -C $$dir -f ../../Makefile MODULE=$${dir/*\//} distclean;\ done make -C src distclean + rm -f bin/* + rmdir bin -include $(wildcard modules/*/makemod) $(wildcard extramodules/*/makemod)