summaryrefslogtreecommitdiff
path: root/Makefile
blob: f7d3abe4a6dd35c76e4a6ecbe7b34277cf77c408 (plain)
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
35
36
PREFIX ?= /usr/local
bindir ?= /bin

MAKEFLAGS += --no-builtin-rules

WARNINGS := -Wall -Wextra -Wpedantic -Wformat=2 -Wstrict-aliasing=3 -Wstrict-overflow=5 -Wstack-usage=12500 \
        -Wfloat-equal -Wcast-align -Wpointer-arith -Wchar-subscripts -Warray-bounds=2

override CFLAGS ?= -g
override CFLAGS += -std=c99 $(WARNINGS)
override CPPFLAGS += -Isrc

bins = ptrace-region-rw ptrace-address-rw uio-region-rw uio-address-rw binsearch bintrim
all: $(bins)

$(bins): %:
        $(LINK.c) $^ $(LDLIBS) -o $@

ptrace-address-rw: src/ptrace-address-rw.c src/cli/proc-address-rw.c src/mem/io-ptrace.c src/mem/io-stream.c
ptrace-region-rw: src/ptrace-region-rw.c src/cli/proc-region-rw.c src/mem/io-ptrace.c src/mem/io-stream.c
uio-region-rw: private CPPFLAGS += -D_GNU_SOURCE
uio-region-rw: src/uio-region-rw.c src/cli/proc-region-rw.c src/mem/io-uio.c src/mem/io-stream.c
uio-address-rw: private CPPFLAGS += -D_GNU_SOURCE
uio-address-rw: src/uio-address-rw.c src/cli/proc-address-rw.c src/mem/io-uio.c src/mem/io-stream.c
binsearch: src/binsearch.c
bintrim: src/bintrim.c

install-bin: $(bins)
        install -Dm755 $^ -t "$(DESTDIR)$(PREFIX)$(bindir)"

install: install-bin

clean:
        $(RM) $(bins)

.PHONY: all clean install