chiark / gitweb /
bug re changelog not relevant since now debian-native
[authbind.git] / Makefile
1 # Makefile for authbind
2
3 # authbind is Copyright (C) 1998 Ian Jackson
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
18 #
19 # $Id$
20
21 prefix=/usr/local
22
23 bin_dir=$(prefix)/bin
24 lib_dir=$(prefix)/lib/authbind
25 libexec_dir=$(lib_dir)
26
27 share_dir=$(prefix)/share
28 man_dir=$(share_dir)/man
29 man1_dir=$(man_dir)/man1
30 man8_dir=$(man_dir)/man8
31
32 etc_dir=/etc/authbind
33
34 INSTALL_FILE=install -o root -g root -m 644 
35 INSTALL_PROGRAM=install -o root -g root -m 755 -s
36 INSTALL_DIR=install -o root -g root -m 755 -d 
37
38 OPTIMISE=       -O2
39 LDFLAGS=        -g
40 LIBS=           -ldl -lc
41 CFLAGS=         -g $(OPTIMISE) \
42                 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit \
43                 -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes
44 CPPFLAGS=       -DMAJOR_VER='"$(MAJOR)"' -DMINOR_VER='"$(MINOR)"' \
45                 -DLIBAUTHBIND='"$(lib_dir)/$(LIBCANON)"' \
46                 -DHELPER='"$(libexec_dir)/$(HELPER)"' -DCONFIGDIR='"$(etc_dir)"' \
47                 -D_GNU_SOURCE
48
49 MAJOR=1
50 MINOR=0
51 LIBCANON=       libauthbind.so.$(MAJOR)
52 LIBTARGET=      $(LIBCANON).$(MINOR)
53 BINTARGETS=     authbind
54 HELPER=         helper
55
56 TARGETS=                $(BINTARGETS) $(HELPER) $(LIBTARGET)
57 MANPAGES_1=             authbind.1
58 MANPAGES_8=             authbind-helper.8
59
60 all:                    $(TARGETS)
61
62 install:                $(TARGETS)
63                 $(INSTALL_DIR) $(lib_dir) $(man1_dir) $(man8_dir)
64                 $(INSTALL_PROGRAM) $(BINTARGETS) $(bin_dir)/.
65                 $(INSTALL_FILE) $(LIBTARGET) $(lib_dir)/.
66                 strip --strip-unneeded $(lib_dir)/$(LIBTARGET)
67                 ln -sf $(LIBTARGET) $(lib_dir)/$(LIBCANON)
68                 $(INSTALL_PROGRAM) $(HELPER) $(libexec_dir)/.
69                 chmod u+s $(libexec_dir)/$(HELPER)
70                 $(INSTALL_DIR) $(etc_dir) \
71                         $(etc_dir)/byport $(etc_dir)/byaddr $(etc_dir)/byuid
72
73 install_man:            $(MANPAGES_1) $(MANPAGES_8)
74                 $(INSTALL_FILE) $(MANPAGES_1) $(man1_dir)/.
75                 $(INSTALL_FILE) $(MANPAGES_8) $(man8_dir)/.
76
77 libauthbind.o:          libauthbind.c authbind.h
78                 $(CC) -D_REENTRANT $(CFLAGS) $(CPPFLAGS) -c -o $@ -fPIC $<
79
80 authbind:               authbind.o
81 helper:                 helper.o
82
83 helper.o authbind.o:    authbind.h
84
85 $(LIBTARGET):           libauthbind.o
86                 ld -shared -soname $(LIBCANON) -o $@ $< $(LIBS)
87
88 clean distclean:
89                 rm -f $(TARGETS) *.o *~ ./#*# *.bak *.new core
90                 rm -f libauthbind.so* *.core