Add configure script and proper install target
This commit is contained in:
parent
ae665c378d
commit
ed4ef3a108
18
Makefile
18
Makefile
@ -1,9 +1,15 @@
|
|||||||
all: getpeername
|
include config.mak
|
||||||
|
|
||||||
# requires busybox nc
|
PREFIX ?=
|
||||||
test:
|
EXEC_PREFIX ?= $(PREFIX)
|
||||||
nc -s 127.1.33.7 -l -p 1234 -e ./getpeername &
|
BINDIR ?= $(EXEC_PREFIX)/bin
|
||||||
nc -w 1 127.1.33.7 1234
|
|
||||||
|
PROGS = getpeername
|
||||||
|
|
||||||
|
all: $(PROGS)
|
||||||
|
|
||||||
|
install: all
|
||||||
|
install -D -m 0755 $(PROGS) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm getpeername
|
rm -f $(PROGS)
|
||||||
|
28
configure
vendored
Executable file
28
configure
vendored
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
while test -n "$1"; do
|
||||||
|
case "$1" in
|
||||||
|
(--*=*)
|
||||||
|
val=${1#--}
|
||||||
|
name=${val%%=*}
|
||||||
|
val=${val#*=}
|
||||||
|
export "$(printf "%s\n" "$name"|tr '[:lower:]-' '[:upper:]_')=$val"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
(
|
||||||
|
# Variables that the makefile uses and that are meant to be configurable
|
||||||
|
awk '/ \?=/ {print($1)}' Makefile
|
||||||
|
# Variables that GNU Make uses for the implicit rules
|
||||||
|
cat <<EOF
|
||||||
|
CC
|
||||||
|
CPPFLAGS
|
||||||
|
CFLAGS
|
||||||
|
LDFLAGS
|
||||||
|
LOADLIBES
|
||||||
|
LDLIBS
|
||||||
|
EOF
|
||||||
|
)|sort -u|while read varname; do
|
||||||
|
eval "test -n \"\${$varname+x}\" && echo \${varname}=\${$varname}"
|
||||||
|
done|tee config.mak
|
Loading…
Reference in New Issue
Block a user