1 diff --git a/Makefile b/Makefile
2 index 7131fc8..1376ea7 100644
6 # sendmail transaction logs. Change the definition of the following macro
7 # if you disagree. See `man 3 syslog' for examples. Some syslog versions
8 # do not provide this flexibility.
13 # To disable tcp-wrapper style access control, comment out the following
14 @@ -15,8 +15,10 @@ FACILITY=LOG_DAEMON
15 # no access control tables. The local system, since it runs the portmap
16 # daemon, is always treated as an authorized host.
18 -HOSTS_ACCESS= -DHOSTS_ACCESS
20 +ifeq ($(NO_TCP_WRAPPER),)
21 +CPPFLAGS += -DHOSTS_ACCESS
25 # Comment out if your RPC library does not allocate privileged ports for
26 # requests from processes with root privilege, or the new portmap will
27 @@ -24,7 +26,7 @@ WRAP_LIB = -lwrap
28 # ports. You can find out by running "rpcinfo -p"; if all mountd and NIS
29 # daemons use a port >= 1024 you should probably disable the next line.
31 -CHECK_PORT = -DCHECK_PORT
32 +CPPFLAGS += -DCHECK_PORT
34 # Warning: troublesome feature ahead!! Enable only when you are really
36 @@ -59,63 +61,52 @@ CHECK_PORT = -DCHECK_PORT
37 # probably much easier to just block port UDP and TCP ports 111 on
40 -# LOOPBACK = -DLOOPBACK_SETUNSET
41 +# CPPFLAGS += -DLOOPBACK_SETUNSET
43 # When the portmapper cannot find any local interfaces (it will complain
44 # to the syslog daemon) your system probably has variable-length socket
45 # address structures (struct sockaddr has a sa_len component; examples:
46 # AIX 4.1 and 4.4BSD). Uncomment next macro definition in that case.
48 -# SA_LEN = -DHAS_SA_LEN # AIX 4.x, BSD 4.4, FreeBSD, NetBSD
49 +# CPPFLAGS += -DHAS_SA_LEN # AIX 4.x, BSD 4.4, FreeBSD, NetBSD
51 # With verbose logging on, HP-UX 9.x and AIX 4.1 leave zombies behind when
52 # SIGCHLD is not ignored. Enable next macro for a fix.
54 -ZOMBIES = -DIGNORE_SIGCHLD # AIX 4.x, HP-UX 9.x
55 +CPPFLAGS += -DIGNORE_SIGCHLD # AIX 4.x, HP-UX 9.x
57 # Uncomment the following macro if your system does not have u_long.
59 -# ULONG =-Du_long="unsigned long"
60 +# CPPFLAGS +=-Du_long="unsigned long"
64 -# NSARCHS = -arch m68k -arch i386 -arch hppa
66 +# CFLAGS += -arch m68k -arch i386 -arch hppa
68 # Auxiliary libraries that you may have to specify
73 # Comment out if your compiler talks ANSI and understands const
76 +# CPPFLAGS += -Dconst=
78 ### End of configurable stuff.
79 ##############################
85 -COPT = $(CONST) $(HOSTS_ACCESS) $(CHECK_PORT) \
86 - $(SYS) -DFACILITY=$(FACILITY) $(ULONG) $(ZOMBIES) $(SA_LEN) \
88 -CFLAGS = $(COPT) $(RPM_OPT_FLAGS) $(NSARCHS) -Wall -Wstrict-prototypes \
90 -OBJECTS = portmap.o pmap_check.o from_local.o
91 +CPPFLAGS += -DFACILITY=$(FACILITY)
93 +CFLAGS += -Wall -Wstrict-prototypes
95 all: portmap pmap_dump pmap_set
98 - $(CC) $(CFLAGS) -pie -o $@ $(OBJECTS) $(WRAP_LIB) $(LIBS)
99 +CPPFLAGS += $(HOSTS_ACCESS)
100 +portmap: CFLAGS += -fpie
101 +portmap: LDLIBS += $(WRAP_LIB)
102 +portmap: LDFLAGS += -pie
103 +portmap: portmap.o pmap_check.o from_local.o
105 -pmap_dump: pmap_dump.c
106 - $(CC) $(CFLAGS) -o $@ $? $(LIBS)
108 -pmap_set: pmap_set.c
109 - $(CC) $(CFLAGS) -o $@ $? $(LIBS)
111 -from_local: from_local.c
112 - cc $(CFLAGS) -DTEST -o $@ from_local.c
113 +from_local: CPPFLAGS += -DTEST
116 install -o root -g root -m 0755 -s portmap ${BASEDIR}/sbin
117 @@ -125,23 +116,12 @@ install: all
118 install -o root -g root -m 0644 pmap_dump.8 ${BASEDIR}/usr/share/man/man8
119 install -o root -g root -m 0644 pmap_set.8 ${BASEDIR}/usr/share/man/man8
122 - lint $(COPT) $(OBJECTS:%.o=%.c)
125 rm -f *.o portmap pmap_dump pmap_set from_local \
129 - chmod 755 . ; chmod -R a+r .
132 - @$(CC) -M $(CFLAGS) *.c | grep -v /usr/include |sed 's/\.\///'
135 + $(CC) -MM $(CFLAGS) *.c > .depend
137 -from_local.o: from_local.c
138 -pmap_check.o: pmap_check.c
139 -pmap_check.o: pmap_check.h Makefile
140 -pmap_dump.o: pmap_dump.c
141 -pmap_set.o: pmap_set.c
142 -portmap.o: portmap.c
143 -portmap.o: pmap_check.h Makefile
144 +.PHONY: all clean install