Makefile (1618B)
1 include config.mk 2 3 .SUFFIXES: 4 .SUFFIXES: .o .c 5 6 HDR = \ 7 util.h 8 9 LIBUTILSRC = \ 10 libutil/enprintf.c \ 11 libutil/env.c \ 12 libutil/io.c \ 13 libutil/mkdirp.c \ 14 libutil/proc.c \ 15 libutil/rm.c \ 16 libutil/service.c \ 17 libutil/strlcpy.c 18 19 20 BIN = \ 21 sysmgr \ 22 runsyssv \ 23 svctl \ 24 sysmgr-depends 25 26 MAN = \ 27 man/runsyssv.1 \ 28 man/svctl.1 \ 29 man/sysmgr-depends.1 \ 30 man/sysmgr.8 31 32 33 SRC = ${BIN:=.c} 34 BINOBJ = ${SRC:.c=.o} 35 36 LIBUTILOBJ = ${LIBUTILSRC:.c=.o} 37 LIBUTIL = libutil.a 38 39 OBJ = ${BINOBJ} ${LIBUTILOBJ} 40 41 all: options ${BIN} 42 43 options: 44 @printf '%s\n' \ 45 "build options for sysmgr:" \ 46 "PREFIX = ${PREFIX}" \ 47 "BINDIR = ${BINDIR}" \ 48 "MANPREFIX = ${MANPREFIX}" "" \ 49 "CFLAGS = ${CFLAGS}" \ 50 "LDFLAGS = ${LDFLAGS}" \ 51 "CPPFLAGS = ${CPPFLAGS}" "" 52 53 ${BIN}: ${LIBUTIL} 54 55 ${OBJ}: ${HDR} 56 57 ${BINOBJ}: config.h 58 59 ${LIBUTIL}: ${LIBUTILOBJ} 60 ${AR} rc $@ $? 61 ${RANLIB} $@ 62 63 .o: 64 ${CC} ${LDFLAGS} -o $@ $< ${LIBUTIL} ${LIBS} 65 66 .c.o: 67 ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ -c $< 68 69 config.h: 70 cp config.def.h $@ 71 72 clean: 73 rm -f ${BIN} ${OBJ} ${LIBUTIL} 74 75 install: all 76 mkdir -p ${DESTDIR}${BINDIR} 77 cp ${BIN} ${DESTDIR}${BINDIR} 78 for bin in ${BIN}; do chmod 755 ${DESTDIR}${BINDIR}/$${bin}; done 79 for man in ${MAN}; do \ 80 mkdir -p ${DESTDIR}${MANPREFIX}/man$${man##*.}; \ 81 sed 's|VERSION|${VERSION}|' < $${man} > ${DESTDIR}${MANPREFIX}/man$${man##*.}/$${man##*/}; \ 82 chmod 644 ${DESTDIR}${MANPREFIX}/man$${man##*.}/$${man##*/}; \ 83 done 84 85 uninstall: 86 for bin in ${BIN}; do rm -f ${DESTDIR}${BINDIR}/$${bin}; done 87 for man in ${MAN}; do rm -f ${DESTDIR}${MANPREFIX}/man$${man##*.}/$${man##*/}; done 88 89 .PHONY: all options clean install uninstall