include config.mk
CFLAGS+= -I. -Ilibopenbsd ${COPTS}
-COPTS+= -Wall -Wextra -Werror -pedantic
+COPTS+= -Wall -Wextra -pedantic -O2 -D_FORTIFY_SOURCE=2
YFLAGS=
all: ${PROG}
OBJS:= ${OBJS:.c=.o}
${PROG}: ${OBJS}
- ${CC} ${CFLAGS} $^ -o $@ ${LDFLAGS}
+ ${CC} ${CFLAGS} $^ -o $@ ${LDFLAGS} ${LDLIBS}
install: ${PROG} ${PAM_DOAS} ${MAN}
mkdir -p -m 0755 ${DESTDIR}${BINDIR}
;;
netbsd)
OS_CFLAGS="$OS_CFLAGS -D_OPENBSD_SOURCE"
- printf 'LDFLAGS += -lutil\n' >>$CONFIG_MK
+ printf 'LDLIBS += -lutil\n' >>$CONFIG_MK
: ${BINGRP:=wheel}
;;
freebsd)
- printf 'LDFLAGS += -lutil\n' >>$CONFIG_MK
+ printf 'LDLIBS += -lutil\n' >>$CONFIG_MK
: ${BINGRP:=wheel}
;;
darwin)
[ -n "$BUILD_STATIC" ] && \
printf 'CFLAGS += -static\n' >>$CONFIG_MK
-# Add CPPFLAGS/CFLAGS/LDFLAGS to CC for testing features
-XCC="${CC:=cc} $CFLAGS $OS_CFLAGS $CPPFLAGS $LDFLAGS"
+# Add CPPFLAGS/CFLAGS/LDFLAGS/LDLIBS to CC for testing features
+XCC="${CC:=cc} $CFLAGS $OS_CFLAGS $CPPFLAGS $LDFLAGS $LDLIBS"
# Make sure to disable --as-needed for CC tests.
case "$OS" in
}'
[ -z "$WITHOUT_PAM" ] && check_func "pam_appl_h" "$src" && {
printf 'SRCS += pam.c\n' >>$CONFIG_MK
- printf 'LDFLAGS += -lpam\n' >>$CONFIG_MK
+ printf 'LDLIBS += -lpam\n' >>$CONFIG_MK
printf '#define USE_PAM\n' >>$CONFIG_H
printf 'pam\n'
}'
[ -z "$WITHOUT_SHADOW" ] && check_func "shadow_h" "$src" && {
printf 'SRCS += shadow.c\n' >>$CONFIG_MK
- printf 'LDFLAGS += -lcrypt\n' >>$CONFIG_MK
+ printf 'LDLIBS += -lcrypt\n' >>$CONFIG_MK
printf '#define USE_SHADOW\n' >>$CONFIG_H
printf 'shadow\n'
return 0