-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
134 lines (111 loc) · 3.93 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Makefile for authbind
#
# authbind is Copyright (C) 1998 Ian Jackson
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# $Id: Makefile,v 1.10 2007-09-23 19:22:24 ian Exp $
prefix=/usr/local
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_USER=root
INSTALL_GROUP=wheel
INSTALL_FILE ?= install -o $(INSTALL_USER) -g $(INSTALL_GROUP) -m 644
INSTALL_PROGRAM ?= install -o $(INSTALL_USER) -g $(INSTALL_GROUP) -m 755 -s
INSTALL_DIR ?= install -o $(INSTALL_USER) -g $(INSTALL_GROUP) -m 755 -d
STRIP ?= strip
# Note that the i386 architecture is deprecated for macOS.
# If you have installed or updated Xcode recently, make of MacOSX-authbind will fail.
# That's why, in the main Makefile the support for i386 has been removed.
# However, if you still need to to build for both architectures, in order to
# interoperate with executables of either arch. For example, the Mac OSX
# Android SDK provides i386 executables, which will fail from dyld failures
# from loading the libauthbind.dylib library if that library is only built
# for e.g. the x86_64 arch. In that case, please use Makefile.i386.
#
# Note that if you are building for Mac M1 hosts, try using `arm64` instead
# of `x86_64` here.
ARCH=-arch x86_64
#ARCH=-arch arm64
OSX_CFLAGS=-flat_namespace
OSX_LDFLAGS=$(ARCH) -dynamiclib -dynamic -flat_namespace
OPTIMISE=-O2
LDFLAGS=$(OSX_LDFLAGS)
LIBS=-ldl
CFLAGS=$(ARCH) -g $(OPTIMISE) -D_REENTRANT \
-Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs \
-Wmissing-prototypes -Wstrict-prototypes $(OSX_CFLAGS)
CPPFLAGS=-DMAJOR_VER='"$(MAJOR)"' \
-DMINOR_VER='"$(MINOR)"' \
-DLIBAUTHBIND='"$(lib_dir)/$(LIBRARY)$(LIBEXT)"' \
-DHELPER='"$(libexec_dir)/helper"' \
-DCONFIGDIR='"$(etc_dir)"' \
-D_GNU_SOURCE \
-DPRELOAD_VAR='"DYLD_INSERT_LIBRARIES"'
LIBRARY=libauthbind
LIBEXT=.dylib
EXES=authbind helper
OBJS=authbind.o helper.o
TARGETS=$(EXES) $(LIBRARY)
MANPAGES_1=authbind.1
MANPAGES_8=authbind-helper.8
all: $(TARGETS)
install: $(TARGETS) install-man
mkdir -p $(bin_dir)
$(INSTALL_PROGRAM) authbind $(bin_dir)/.
chmod a+x $(bin_dir)/authbind
mkdir -p $(libexec_dir)
$(INSTALL_PROGRAM) helper $(libexec_dir)/.
chmod u+s $(libexec_dir)/helper
mkdir -p $(lib_dir)
$(INSTALL_FILE) $(LIBRARY)$(LIBEXT) $(lib_dir)/.
# $(STRIP) --strip-unneeded $(lib_dir)/$(LIBTARGET)
# ln -sf $(LIBTARGET) $(lib_dir)/$(LIBCANON)
$(INSTALL_DIR) $(etc_dir) $(etc_dir)/byport $(etc_dir)/byaddr $(etc_dir)/byuid
uninstall:
rm -f \
$(bin_dir)/authbind \
$(libexec_dir)/helper \
$(libexec_dir)/$(LIBRARY)$(LIBEXT)
rm -df \
$(libexec_dir)
uninstall-conf:
rm -rf $(etc_dir)
install-man: $(MANPAGES_1) $(MANPAGES_8)
$(INSTALL_DIR) $(man1_dir) $(man8_dir)
$(INSTALL_FILE) $(MANPAGES_1) $(man1_dir)/.
$(INSTALL_FILE) $(MANPAGES_8) $(man8_dir)/.
uninstall-man:
rm -f \
$(addprefix $(man1_dir)/,$(MANPAGES_1)) \
$(addprefix $(man8_dir)/,$(MANPAGES_8))
.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
authbind: authbind.o
$(CC) -o $@ $<
helper: helper.o
$(CC) -o $@ $<
$(LIBRARY):
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@$(LIBEXT) [email protected] $(LIBS)
clean distclean:
$(RM) $(TARGETS) *.o *~ ./#*# *.bak *.new core
$(RM) $(LIBRARY)$(LIBEXT) *.core
$(RM) -r $(LIBRARY)$(LIBEXT).dSYM/