3 ################ Source files ########################################
6 SRCS
= $(wildcard *.
cc) $(foreach dir, ${CDIRS}, $(wildcard $(dir)/*.
cc))
7 INCS
= $(filter-out bsconf.h
, $(wildcard *.h
)) $(foreach dir, ${CDIRS}, $(wildcard $(dir)/*.h
))
11 ################ Library link names ##################################
13 LIBA
= lib
${LIBNAME}.a
14 LIBSO
= lib
${LIBNAME}.so
16 LIBSOLNK
= ${LIBSO}.
${MAJOR}
17 LIBSOBLD
= ${LIBSO}.
${MAJOR}.
${MINOR}.
${BUILD}
19 TOCLEAN
+= ${LIBSO} ${LIBA} ${LIBSOBLD}
21 ALLINST
= install-incs
23 ALLLIBS
+= ${LIBSOBLD}
24 ALLINST
+= install-shared
28 ALLINST
+= install-static
31 ################ Compilation #########################################
33 .PHONY
: all install uninstall install-incs uninstall-incs
34 .PHONY
: install-static install-shared uninstall-static uninstall-shared
35 .PHONY
: clean depend html
check dist distclean maintainer-clean
40 @echo
" Compiling $< ..."
41 @
${CXX} ${CXXFLAGS} -o
$@
-c
$<
44 @echo
" Compiling $< to assembly ..."
45 @
${CXX} ${CXXFLAGS} -S
-g0
-Os
-DNDEBUG
=1 -fomit-frame-pointer
-o
$@
-c
$<
50 ################ Installation ########################################
53 uninstall: $(subst install,uninstall,${ALLINST})
56 @echo
"Linking $@ ..."
61 @echo
"Linking $@ ..."
62 @
${LD} ${LDFLAGS} ${SHBLDFL} -o
$@
$^
${LIBS}
64 install-shared
: ${LIBSOBLD}
65 @echo
"Installing ${LIBSOBLD} to ${LIBDIR} ..."
66 @
${INSTALLDIR} ${LIBDIR}
67 @
${INSTALLLIB} ${LIBSOBLD} ${LIBDIR}
68 @
(cd
${LIBDIR}; ln
-sf
${LIBSOBLD} ${LIBSO}; ln
-sf
${LIBSOBLD} ${LIBSOLNK})
71 @echo
"Removing ${LIBSOBLD} from ${LIBDIR} ..."
72 @
rm -f
${LIBDIR}/${LIBSO} ${LIBDIR}/${LIBSOLNK} ${LIBDIR}/${LIBSOBLD}
74 install-static
: ${LIBA}
75 @echo
"Installing ${LIBA} to ${LIBDIR} ..."
76 @
${INSTALLDIR} ${LIBDIR}
77 @
${INSTALLLIB} ${LIBA} ${LIBDIR}
80 @echo
"Removing ${LIBA} from ${LIBDIR} ..."
81 @
rm -f
${LIBDIR}/${LIBA}
84 @echo
"Installing headers to ${INCDIR} ..."
85 @
${INSTALLDIR} ${INCDIR}/${LIBNAME}
86 @for i in
$(filter-out ${LIBNAME}.h
, ${INCS}); do \
87 ${INSTALLDIR} `dirname ${INCDIR}/${LIBNAME}/$$i`; \
88 ${INSTALLDATA} $$i ${INCDIR}/${LIBNAME}/$$i; \
90 @
${INSTALLDATA} ${LIBNAME}.h
${INCDIR}
93 @echo
"Removing headers from ${INCDIR} ..."
94 @
rm -rf
${INCDIR}/${LIBNAME} ${INCDIR}/${LIBNAME}.h
96 ################ Maintenance ###########################################
99 @echo
"Removing generated files ..."
100 @
rm -f
${OBJS} ${TOCLEAN}
104 @for i in
${SRCS}; do \
105 ${CXX} ${CXXFLAGS} -M
-MT
$${i
%%.
cc}.o
$$i >> .depend
; \
109 DISTDIR
= ${HOME}/stored
110 DISTNAM
= ${LIBNAME}-${MAJOR}.
${MINOR}
111 DISTTAR
= ${DISTNAM}.
${BUILD}.
tar.bz2
114 mkdir
${TMPDIR}/${DISTNAM}
115 cp
-r .
${TMPDIR}/${DISTNAM}
116 +make
-C
${TMPDIR}/${DISTNAM} html
distclean
117 (cd
${TMPDIR}/${DISTNAM}; rm -rf
`find . -name .svn`)
118 (cd
${TMPDIR}; tar jcf
${DISTDIR}/${DISTTAR} ${DISTNAM}; rm -rf
${DISTNAM})
121 @
rm -f Config.mk config.h bsconf.o bsconf .depend
123 maintainer-clean
: distclean