File: GNUmakefile

package info (click to toggle)
netstat-nat 2a-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: ansic: 609; sh: 68; makefile: 14
file content (34 lines) | stat: -rw-r--r-- 1,115 bytes parent folder | download
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
# SPDX-License-Identifier: 0BSD

CC ?= cc
VERSION ?= $(shell git describe)
DATE_EPOCH = LC_ALL=C date $(shell date -d @0 > /dev/null 2>&1 && echo "-d @" || echo "-r ")
SOURCE_DATE_EPOCH ?= $(shell git log -1 --no-show-signature --format=%at "netstat-nat.1.in")
MANUAL_DATE ?= $(shell $(DATE_EPOCH)$(SOURCE_DATE_EPOCH) +"%B %e, %Y")
PREFIX ?= /usr/local


CPPFLAGS += -D_GNU_SOURCE
CFLAGS   += -O3 -g -Wall -Wextra -std=c17 -Wno-string-plus-int


.PHONY: all check clean install

all: netstat-nat netstat-nat.1
clean:
	rm -f netstat-nat tst netstat-nat.1
check: tst netstat-nat
	./tst
	./test


install: all
	mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
	cp netstat-nat   $(DESTDIR)$(PREFIX)/bin
	cp netstat-nat.1 $(DESTDIR)$(PREFIX)/share/man/man1

netstat-nat.1: netstat-nat.1.in
	awk '{gsub(/ \^/, " \\(ha"); gsub(/ ~/, " \\(ti"); if($$1 == ".Dd") $$2 = "$(MANUAL_DATE)"; if($$1 == ".Dt") print ".ds doc-volume-operating-system"; if($$1 == ".Os") $$2 = "netstat-nat-ng $(VERSION)"; print}' < $< > $@

tst: CPPFLAGS += -DTEST
tst: CFLAGS   += -Wno-unused-function -Wno-unused-const-variable