OPTFLAGS := -O2
DBGFLAGS := -ggdb
PRFFLAGS := ${DBGFLAGS} -pg
-MYFLAGS := -Wall -pedantic -ansi
+MYFLAGS := -Wall -pedantic -ansi -fPIC
VALFLAGS := --leak-check=full
CXXFLAGS := ${MYFLAGS} ${DBGFLAGS}
WORKINGDIR := bind/
-TARGETNAME := libpg.so
-TARGETTMP := ${OBJSDIR}${TARGETNAME}
-TARGET := ${WORKINGDIR}${TARGETNAME}
+LINKERNAME := libpg.so
+SONAME := libpg.so.1
+REALNAME := libpg.so.1.0
+
+TARGETTMP := ${OBJSDIR}${REALNAME}
+TARGET := ${WORKINGDIR}${REALNAME}
DEPSBLDDIRS := ${DEPSDIR} $(addprefix ${DEPSDIR},${DIRS})
OBJSBLDDIRS := ${OBJSDIR} $(addprefix ${OBJSDIR},${DIRS})
# how to link the main target
${TARGETTMP}: ${OBJS}
${Q1}${PRNTFMT} "${CXX}" "$@"
- ${Q2}${CXX} -shared ${CXXFLAGS} -o $@ $^ ${LIBS}
+ ${Q2}${CXX} ${CXXFLAGS} -shared -Wl,-soname,${SONAME} -o $@ $^ ${LIBS}
# rule to copy tmp target to working directory
${TARGET}: ${TARGETTMP} | ${WORKINGDIR}
.PHONY: cleanall
cleanall: clean cleanbin cleandeps
-.PHONY: gitclean
-gitclean:
- ${Q1}${PRNTFMT} "git clean" "showing; use gitcleanf to force removal"
- ${Q2}git clean -nxd
-
-.PHONY: gitcleanf
-gitcleanf:
- ${Q1}${PRNTFMT} "git clean" "forcing"
- ${Q2}git clean -fxd
- cd ${WORKINGDIR}; gprof -b ${TARGETNAME} > prof
- cd ${WORKINGDIR}; kprof -f prof
-
-include ${DEPS}