# Make.rules -*- Makefile -*- # # Common rules for building stuff. All of the Makefiles include this # file. # # $Id: Make.rules.in,v 1.20 2001/11/19 17:05:33 arensb Exp $ # Note: there aren't many portable Makefile constructs. In particular, # various versions of 'make' don't recognize one or more of # VAR += VALUE # VAR ?= DEFAULT_VALUE # VAR != command # so don't use these. # The basics PACKAGE = coldsync VERSION = 2.2.5 # Various directories gleaned from `configure' PREFIX = /usr/local # Grrr... Freakin' capitalization! prefix = ${PREFIX} # GNU 'configure'-ism exec_prefix = ${prefix} BINDIR = ${exec_prefix}/bin SBINDIR = ${exec_prefix}/sbin LIBEXECDIR = ${exec_prefix}/libexec CONDUITDIR = ${LIBEXECDIR}/coldsync DATADIR = ${prefix}/share LOCALEDIR = ${DATADIR}/locale SYSCONFDIR = ${prefix}/etc LIBDIR = ${exec_prefix}/lib INCLUDEDIR = ${prefix}/include INFODIR = ${prefix}/info MANDIR = ${prefix}/man MAN1DIR = ${MANDIR}/man1 MAN3DIR = ${MANDIR}/man3 MAN8DIR = ${MANDIR}/man8 # Subdirectory containing the Perl modules. Used by "configure --without-perl" PERLDIRS = # Compilation-related programs and flags CC = cc CXX = c++ DEFINES = -DHAVE_CONFIG_H INCLUDES = -I. -I${TOP} -I${TOP}/include CXX_INCLUDEDIRS = \ -I/usr/include/c++ -I/usr/include/g++ \ -I${INCLUDEDIR} CPPFLAGS = ${DEFINES} ${INCLUDES} -I/usr/local/include CFLAGS = -fno-common ${CPPFLAGS} CXXFLAGS = -fno-common ${CPPFLAGS} LEX = flex LEXARGS = LIBLEX = -lfl YACC = bison -y YACCARGS = -d LIBYACC = -ly LIBS = -lintl ${EXTRA_LIBS} LDFLAGS = -L/usr/local/lib ${LIBS} LINT = LINTARGS = -hxFH ${CPPFLAGS} RANLIB = ranlib # Other programs and utilities PERL = /usr/local/bin/perl # The name "POD2MAN_EXE" is because Perl uses "POD2MAN" for the actual # rule that creates man pages from pods. POD2MAN_EXE = /usr/local/bin/pod2man SED = /usr/local/bin/sed TAR = gtar GZIP = gzip DATE = date MKDEP = mkdep MAKEINFO = makeinfo TEXI2DVI = texi2dvi TEXI2HTML = texi2html DVIPS = dvips MKID = mkid MKDIR = ${TOP}/mkinstalldirs # I18n-related utilities XGETTEXT = xgettext GETTEXT = gettext MSGMERGE = msgmerge MSGFMT = msgfmt EXTRA_MSGFMT_ARGS = --statistics --strict INSTALL_I18N = yes TOPDISTDIR = ${TOP}/${PACKAGE}-${VERSION} DISTDIR = ${TOPDISTDIR}/${SUBDIR} TARBALL = ${TOPDISTDIR}.tar.gz INSTALL = /usr/bin/install -c -o root -g wheel INSTALL_PROGRAM = install -s -o root -g wheel -m 555 -m 555 INSTALL_SCRIPT = install -o root -g wheel -m 555 INSTALL_DATA = install -o root -g wheel -m 444 INSTALL_MAN = ${INSTALL_DATA} # End of 'configure'-generated stuff. .SUFFIXES: .c .o .cc .ln .SUFFIXES: .a .SUFFIXES: .So .so .c.o: ${CC} ${CFLAGS} -c $< # XXX - Shared library object. This is only known to work under # FreeBSD 4.2 for now. .c.So: ${CC} -fPIC -DPIC ${CFLAGS} -c $< -o $@ ${LD} -o $@.tmp -x -r $@ mv $@.tmp $@ .cc.o: ${CXX} ${CXXFLAGS} -c $< .c.ln: ${LINT} ${LINTARGS} -i $< # Documentation-related rules .SUFFIXES: .dvi .info .ps .texi .html .texi.info: ${MAKEINFO} $< .texi.dvi: ${TEXI2DVI} $< .dvi.ps: ${DVIPS} -o $@ $< # I18n-related rules .SUFFIXES: .po .mo .po.mo: ${MSGFMT} -v ${EXTRA_MSGFMT_ARGS} -o $@ $< LIBRARY = lib${LIBNAME}.a SHLIB = lib${LIBNAME}.so SHLIBVER = lib${LIBNAME}.so.${SHLIB_MAJOR} # List of recursive targets, i.e., those where you build the target in # each subdirectory. RECURSIVE_TARGETS = \ all depend clean distclean spotless distfiles-core distfiles \ install lint TAGS # This empty rule is so that `make' (build the first target) and `make # all' will do the same thing. `all' is actually built according to # the ${RECURSIVE_TARGETS} rule. all:: # XXX - Should add "-R ${LIBDIR}" or "-rpath ${LIBDIR}" or "-Wl,-rpath # ${LIBDIR}", whichever one the linker supports. ${PROG}: ${OBJS} ${CC} ${CFLAGS} ${OBJS} -o $@ ${LDFLAGS} ${CXXPROG}: ${OBJS} ${CXX} ${CXXFLAGS} ${OBJS} -o $@ ${LDFLAGS} ${LIBRARY}: ${LIBOBJS} ar cr $@ ${LIBOBJS} ${RANLIB} $@ # XXX - Build a shared library from .So object files. This is only # known to work under FreeBSD 4.2 for now. ${SHLIB} ${SHLIBVER}: ${SHLIBOBJS} -rm -f ${SHLIBVER} ${SHLIB} -ln -f -s ${SHLIBVER} ${SHLIB} ${CC} -shared -Wl,-x -o ${SHLIBVER} -Wl,-soname,${SHLIBVER} \ `lorder ${SHLIBOBJS} | tsort -q` # lex.yy.o: lex.yy.c # ${CC} ${CFLAGS} -c $< lex.yy.c: lexer.l y.tab.h ${LEX} ${LEXARGS} lexer.l # y.tab.o: y.tab.c # ${CC} ${CFLAGS} -c $< y.tab.c y.tab.h: parser.y ${YACC} ${YACCARGS} parser.y # XXX - Ought to come up with a rule that'll do the Right Thing in all # cases, whether you have C source, C++ source, or a mixture of both. # depend:: # ${MKDEP} ${CPPFLAGS} ${C_SRCS} ${CXX_INCLUDEDIRS} ${CXX_SRCS} # Targets for building the distribution. # See the comment by ${RECURSIVE_TARGETS}::. distfiles-core:: ${DISTFILES} @subdirs="${SUBDIRS}"; \ for dir in "${subdirs}"; do \ if test ! -d "${TOPDISTDIR}/${SUBDIR}/$$dir"; then \ echo "mkdir ${TOPDISTDIR}/${SUBDIR}/$$dir"; \ ${MKDIR} "${TOPDISTDIR}/${SUBDIR}/$$dir"; \ fi; \ done @if test -n "${DISTFILES}"; then \ echo "cp -p ${DISTFILES} ${TOPDISTDIR}/${SUBDIR}"; \ cp -p ${DISTFILES} ${TOPDISTDIR}/${SUBDIR}; \ fi distfiles:: distfiles-core ${EXTRA_DISTFILES} @if test -n "${EXTRA_DISTFILES}"; then \ echo "cp -p ${EXTRA_DISTFILES} ${TOPDISTDIR}/${SUBDIR}"; \ cp -p ${EXTRA_DISTFILES} ${TOPDISTDIR}/${SUBDIR}; \ fi TAGS:: files="${SRCS} ${HEADERS} ${OTHERTAGFILES}"; \ for f in $$files; do \ etags -a -o ${TOP}/TAGS $$f; \ done # Common rule for building recursive targets # The completely redundant subdirs="${SUBDIRS}" assignment is there # because Sun's 'sh' can't parse # for i in ; do echo $i; done # It complains about a syntax error. ${RECURSIVE_TARGETS}:: @subdirs="${SUBDIRS}"; \ for dir in $$subdirs; do \ echo "$@: Entering directory \`${SUBDIR}/$$dir'"; \ (cd $$dir && \ ${MAKE} SUBDIR="${SUBDIR}/$$dir" TOP=${TOP}/.. \ PREFIX="${PREFIX}" prefix="${prefix}" $@); \ echo "$@: Leaving directory \`${SUBDIR}/$$dir'"; \ done # Targets for various progressive levels of cleanliness. Each one is # cleaner than the previous. These need to go after the # ${RECURSIVE_TARGETS} rule, because we want to clean up the lower # directories before cleaning up the higher ones. # # clean: Delete all the files added by the compilation process # (*.o, core, etc.) # distclean: Delete anything that wasn't part of the distribution # (clean + anything created by `configure') # spotless: Delete anything that can't be recreated (distclean + # `configure' itself, .ps files generated for the distribution # as a courtesy, etc.) clean-here: -rm -f ${CLEAN} clean:: clean-here distclean-here: -rm -f ${CLEAN} ${DISTCLEAN} distclean:: distclean-here spotless-here: -rm -f ${CLEAN} ${DISTCLEAN} ${SPOTLESS} spotless:: spotless-here