chiark / gitweb /
8c6e90c1a39a14e1e176b260cd218538709d24b7
[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
26 share_dir=$(prefix)/share
27 man_dir=$(share_dir)/man
28 man1_dir=$(man_dir)/man1
29 man8_dir=$(man_dir)/man8
30
31 etc_dir=/etc/authbind
32
33 OPTIMISE=       -O2
34 LDFLAGS=        -g
35 CFLAGS=         -g $(OPTIMISE) \
36                 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit \
37                 -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes
38 CPPFLAGS=       -DMAJOR_VER='"$(MAJOR)"' -DMINOR_VER='"$(MINOR)"' \
39                 -DLIBAUTHBIND='"$(lib_dir)/$(LIBCANON)"' \
40                 -DHELPER='"$(lib_dir)/helper"' -DCONFIGDIR='"$(etc_dir)"' \
41                 -D_GNU_SOURCE
42
43 MAJOR=1
44 MINOR=0
45 LIBCANON=       libauthbind.so.$(MAJOR)
46 LIBTARGET=      $(LIBCANON).$(MINOR)
47
48 TARGETS=                authbind helper $(LIBTARGET)
49 MANPAGES_1=             authbind.1
50 MANPAGES_8=             authbind-helper.8
51
52 all:                    $(TARGETS)
53
54 install:                $(TARGETS)
55                 install -o root -g root -m 755 -d $(lib_dir) $(man1_dir) $(man8_dir)
56                 install -o root -g root -m 755 -s authbind $(bin_dir)/.
57                 install -o root -g root -m 644 $(LIBTARGET) $(lib_dir)/.
58                 strip --strip-unneeded $(lib_dir)/$(LIBTARGET)
59                 ln -sf $(LIBTARGET) $(lib_dir)/$(LIBCANON)
60                 install -o root -g root -m 4755 -s helper $(lib_dir)/.
61                 install -o root -g root -m 755 -d $(etc_dir) \
62                         $(etc_dir)/byport $(etc_dir)/byaddr $(etc_dir)/byuid
63
64 install_man:            $(MANPAGES_1) $(MANPAGES_8)
65                 install -o root -g root -m 644 $(MANPAGES_1) $(man1_dir)/.
66                 install -o root -g root -m 644 $(MANPAGES_8) $(man8_dir)/.
67
68 libauthbind.o:          libauthbind.c authbind.h
69                 $(CC) -D_REENTRANT $(CFLAGS) $(CPPFLAGS) -c -o $@ -fPIC $<
70
71 authbind:               authbind.o
72 helper:                 helper.o
73
74 helper.o authbind.o:    authbind.h
75
76 $(LIBTARGET):           libauthbind.o
77                 ld -shared -soname $(LIBCANON) -o $@ $< -ldl -lc
78
79 clean distclean:
80                 rm -f $(TARGETS) *.o *~ ./#*# *.bak *.new core libauthbind.so*