X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=authbind.git;a=blobdiff_plain;f=Makefile;h=ac988af2b9a2c177d2375150d789b7cb529745cc;hp=12aae95198406832f2d694cf0fdffe6f192911f8;hb=9243a9602f7aa38b68248b8217630c497d3c15a3;hpb=3f781654282c8c85317394dfd874483c4321fac1 diff --git a/Makefile b/Makefile index 12aae95..ac988af 100644 --- a/Makefile +++ b/Makefile @@ -19,51 +19,73 @@ # $Id$ prefix=/usr/local -share_dir=$(prefix)/share -etc_dir=/etc/authbind + +bin_dir=$(prefix)/bin lib_dir=$(prefix)/lib/authbind +libexec_dir=$(lib_dir) + +share_dir=$(prefix)/share man_dir=$(share_dir)/man man1_dir=$(man_dir)/man1 man8_dir=$(man_dir)/man8 +etc_dir=/etc/authbind + +INSTALL_FILE ?= install -o root -g root -m 644 +INSTALL_PROGRAM ?= install -o root -g root -m 755 -s +INSTALL_DIR ?= install -o root -g root -m 755 -d +STRIP ?= strip + OPTIMISE= -O2 +LDFLAGS= -g +LIBS= -ldl -lc CFLAGS= -g $(OPTIMISE) \ -Wall -Wwrite-strings -Wpointer-arith -Wimplicit \ -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes CPPFLAGS= -DMAJOR_VER='"$(MAJOR)"' -DMINOR_VER='"$(MINOR)"' \ -DLIBAUTHBIND='"$(lib_dir)/$(LIBCANON)"' \ - -DHELPER='"$(prefix)/helper"' -DCONFIGDIR='"$(etc_dir)"' + -DHELPER='"$(libexec_dir)/$(HELPER)"' -DCONFIGDIR='"$(etc_dir)"' \ + -D_GNU_SOURCE MAJOR=1 MINOR=0 LIBCANON= libauthbind.so.$(MAJOR) LIBTARGET= $(LIBCANON).$(MINOR) +BINTARGETS= authbind +HELPER= helper -TARGETS= authbind helper $(LIBTARGET) -MANPAGES_1= authbind -MANPAGES_8= authbind-helper +TARGETS= $(BINTARGETS) $(HELPER) $(LIBTARGET) +MANPAGES_1= authbind.1 +MANPAGES_8= authbind-helper.8 all: $(TARGETS) install: $(TARGETS) - install -o root -g root -m 755 -d $(lib_dir) $(man_dir) - install -o root -g root -m 755 authbind $(bin_dir)/. - install -o root -g root -m 755 $(LIBTARGET) $(lib_dir)/. - strip --strip-unneeded $(lib_dir)/$(LIBTARGET) - ln -s $(LIBTARGET) $(lib_dir)/$(LIBCANON) - install -o root -g root -m 4755 helper $(lib_dir)/. - install -o root -g root -m 755 -d $(etc_dir) \ + $(INSTALL_DIR) $(lib_dir) $(man1_dir) $(man8_dir) + $(INSTALL_PROGRAM) $(BINTARGETS) $(bin_dir)/. + $(INSTALL_FILE) $(LIBTARGET) $(lib_dir)/. + $(STRIP) --strip-unneeded $(lib_dir)/$(LIBTARGET) + ln -sf $(LIBTARGET) $(lib_dir)/$(LIBCANON) + $(INSTALL_PROGRAM) $(HELPER) $(libexec_dir)/. + chmod u+s $(libexec_dir)/$(HELPER) + $(INSTALL_DIR) $(etc_dir) \ $(etc_dir)/byport $(etc_dir)/byaddr $(etc_dir)/byuid install_man: $(MANPAGES_1) $(MANPAGES_8) - install -o root -g root -m 644 $(MANPAGES_1) $(man1_dir)/. - install -o root -g root -m 644 $(MANPAGES_8) $(man8_dir)/. + $(INSTALL_FILE) $(MANPAGES_1) $(man1_dir)/. + $(INSTALL_FILE) $(MANPAGES_8) $(man8_dir)/. -libauthbind.o: libauthbind.c +libauthbind.o: libauthbind.c authbind.h $(CC) -D_REENTRANT $(CFLAGS) $(CPPFLAGS) -c -o $@ -fPIC $< +authbind: authbind.o +helper: helper.o + +helper.o authbind.o: authbind.h + $(LIBTARGET): libauthbind.o - gcc -g -shared -Wl,-soname,$(LIBCANON) -o $@ $< -ldl -lc + ld -shared -soname $(LIBCANON) -o $@ $< $(LIBS) clean distclean: - rm -f $(TARGETS) *.o *~ ./#*# *.bak *.new core libauthbind.so* + rm -f $(TARGETS) *.o *~ ./#*# *.bak *.new core + rm -f libauthbind.so* *.core