Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ nshdoas/*.o
nshdoas/compile.c
nshdoas/nshdoas
nshdoas/parse.c
.depend
82 changes: 66 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#
PROG= nsh

SUBDIR += bgpnsh nshdoas

.PHONY: release dist

.include "nsh-version.mk"
Expand All @@ -19,27 +17,79 @@ MANDIR?=${PREFIX}/man/man
.endif

# For use with flashrd:
#CFLAGS=-O -DDHCPLEASES=\"/flash/dhcpd.leases\" -Wmissing-prototypes -Wformat -Wall -Wpointer-arith -Wbad-function-cast #-W
CFLAGS=-O -DDHCPLEASES=\"/flash/dhcpd.leases\" -Wmissing-prototypes -Wformat -Wall -Wpointer-arith -Wbad-function-cast #-W
CFLAGS?=-O
CFLAGS+=-Wmissing-prototypes -Wformat -Wall -Wbad-function-cast -I/usr/local/include #-W -Wpointer-arith
CFLAGS+=-Wmissing-prototypes -Wformat -Wall -Wbad-function-cast -I/usr/local/include -Wno-error -Wno-unused-variable -Wno-implicit-function-declaration -Wno-pointer-sign -Wbad-function-cast -o ${.TARGET} #-W -Wpointer-arith
CPPFLAGS+=-DNSH_VERSION=${NSH_VERSION}

SRCS=arp.c compile.c main.c genget.c commands.c bgpcommands.c stats.c kroute.c
SRCS+=ctl.c show.c if.c version.c route.c conf.c complete.c ieee80211.c
SRCS+=bridge.c tunnel.c media.c sysctl.c passwd.c pfsync.c carp.c
SRCS+=trunk.c who.c more.c stringlist.c utils.c sqlite3.c ppp.c prompt.c
SRCS+=nopt.c pflow.c wg.c nameserver.c ndp.c umb.c utf8.c cmdargs.c ctlargs.c
SRCS+=helpcommands.c makeargv.c hashtable.c mantab.c
CLEANFILES+=compile.c mantab.c
OSNAME != uname
.if $(OSNAME) == "OpenBSD"
# bgpnsh and nshdoas needs some porting work, eg: sudo?
# unveil() also is OpenBSD specific
SUBDIR += openbsd/bgpnsh openbsd/nshdoas

SRCS=openbsd/arp.c openbsd/compile.c openbsd/main.c openbsd/genget.c openbsd/commands.c openbsd/bgpcommands.c openbsd/stats.c openbsd/kroute.c
SRCS+=openbsd/ctl.c openbsd/show.c openbsd/if.c openbsd/version.c openbsd/route.c openbsd/conf.c openbsd/complete.c openbsd/ieee80211.c
SRCS+=openbsd/bridge.c openbsd/tunnel.c openbsd/media.c openbsd/sysctl.c openbsd/passwd.c openbsd/pfsync.c openbsd/carp.c
SRCS+=openbsd/trunk.c openbsd/who.c openbsd/more.c openbsd/stringlist.c openbsd/utils.c openbsd/sqlite3.c openbsd/ppp.c openbsd/prompt.c
SRCS+=openbsd/nopt.c openbsd/pflow.c openbsd/wg.c openbsd/nameserver.c openbsd/ndp.c openbsd/umb.c openbsd/utf8.c openbsd/cmdargs.c openbsd/ctlargs.c
SRCS+=openbsd/helpcommands.c openbsd/makeargv.c openbsd/hashtable.c openbsd/mantab.c
CLEANFILES+=openbsd/compile.c openbsd/mantab.c
LDADD=-lutil -ledit -ltermcap -lsqlite3 -L/usr/local/lib #-static

MAN=nsh.8
openbsd/compile.c: openbsd/compile.sh *.c *.h
cd openbsd; sh ${.CURDIR}/openbsd/compile.sh

openbsd/mantab.c: openbsd/mantab.sh nsh.8
cd openbsd; sh ${.CURDIR}/openbsd/mantab.sh ${.CURDIR}/nsh.8 > mantab.c
.endif

.if $(OSNAME) == "NetBSD"
SRCS=netbsd/ctl.c netbsd/compile.c netbsd/main.c netbsd/genget.c netbsd/commands.c netbsd/more.c netbsd/complete.c netbsd/passwd.c
SRCS+=netbsd/conf.c netbsd/sqlite3.c netbsd/who.c netbsd/version.c
CLEANFILES+=netbsd/compile.c
LDADD=-ledit -ltermcap -lsqlite3 -L/usr/local/lib -static

NOMAN=1

netbsd/compile.c: netbsd/compile.sh
cd netbsd; sh ${.CURDIR}/netbsd/compile.sh
.endif

compile.c: compile.sh *.c *.h
sh ${.CURDIR}/compile.sh
# For Darwin, brew install bmake and run `bmake`
.if $(OSNAME) == "Darwin"
SRCS=darwin/ctl.c darwin/compile.c darwin/main.c darwin/genget.c darwin/commands.c darwin/more.c darwin/complete.c darwin/passwd.c
SRCS+=darwin/conf.c darwin/sqlite3.c darwin/who.c darwin/version.c
CLEANFILES+=darwin/compile.c
LDADD=-ledit -ltermcap -lsqlite3 -L/usr/local/lib

mantab.c: mantab.sh nsh.8
sh ${.CURDIR}/mantab.sh ${.CURDIR}/nsh.8 > mantab.c
darwin/compile.c: darwin/compile.sh
cd darwin; sh ${.CURDIR}/darwin/compile.sh
.endif

# For Linux, install bmake and run `bmake`
.if $(OSNAME) == "Linux"
SRCS=linux/ctl.c linux/compile.c linux/main.c linux/genget.c linux/commands.c linux/more.c linux/complete.c linux/passwd.c
SRCS+=linux/conf.c linux/sqlite3.c linux/version.c linux/who.c
CLEANFILES+=linux/compile.c
LDADD=-lbsd -ledit -ltermcap -lsqlite3 -L/usr/local/lib

linux/compile.c: linux/compile.sh
cd linux; sh ${.CURDIR}/linux/compile.sh
.endif

.if $(OSNAME) == "FreeBSD"
SRCS=freebsd/ctl.c freebsd/utils.c freebsd/compile.c freebsd/who.c freebsd/main.c freebsd/genget.c freebsd/more.c freebsd/complete.c freebsd/passwd.c
SRCS+=freebsd/conf.c freebsd/version.c freebsd/sqlite3.c
SRCS+=freebsd/commands.c
CLEANFILES+=freebsd/compile.c
LDADD=-ledit -lutil -lpthread -lmemstat -lelf -lkvm -lxo -lm -ltermcap -lsqlite3 -L/usr/lib -L/usr/local/lib

freebsd/compile.c: freebsd/compile.sh
cd freebsd; sh ${.CURDIR}/freebsd/compile.sh
.endif

MAN=nsh.8

release: clean
sed -i -e "s/_RELEASE=No/_RELEASE=Yes/" ${.CURDIR}/nsh-version.mk
Expand Down
Loading