Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 1 | ## |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 2 | ## SPDX-License-Identifier: GPL-2.0-only |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 3 | |
Denis 'GNUtoo' Carikli | c2b5108 | 2015-11-11 05:40:11 +0100 | [diff] [blame] | 4 | PROGRAM = cbmem |
Werner Zeh | 1c727fd | 2022-11-16 10:58:35 +0100 | [diff] [blame] | 5 | TOP ?= $(abspath ../..) |
| 6 | ROOT = $(TOP)/src |
Julius Werner | c228bef | 2024-01-30 19:33:40 -0800 | [diff] [blame] | 7 | COMMONLIB = $(ROOT)/commonlib |
Denis 'GNUtoo' Carikli | c2b5108 | 2015-11-11 05:40:11 +0100 | [diff] [blame] | 8 | CC ?= $(CROSS_COMPILE)gcc |
Yegor Timoshenko | c2e4941 | 2018-10-07 01:58:27 +0000 | [diff] [blame] | 9 | INSTALL ?= /usr/bin/env install |
Denis 'GNUtoo' Carikli | c2b5108 | 2015-11-11 05:40:11 +0100 | [diff] [blame] | 10 | PREFIX ?= /usr/local |
| 11 | CFLAGS ?= -O2 |
Martin Roth | 2ae8939 | 2021-02-14 15:04:12 -0700 | [diff] [blame] | 12 | WERROR=-Werror |
| 13 | CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wshadow $(WERROR) |
Julius Werner | 98eeb96 | 2019-12-11 15:47:42 -0800 | [diff] [blame] | 14 | CPPFLAGS += -I . -I $(ROOT)/commonlib/include -I $(ROOT)/commonlib/bsd/include |
| 15 | CPPFLAGS += -include $(ROOT)/commonlib/bsd/include/commonlib/bsd/compiler.h |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 16 | |
Julius Werner | c228bef | 2024-01-30 19:33:40 -0800 | [diff] [blame] | 17 | OBJS = $(PROGRAM).o $(COMMONLIB)/bsd/ipchksum.o |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 18 | |
Vadim Bendebury | 7c6b6bb | 2012-10-19 10:57:18 -0700 | [diff] [blame] | 19 | all: $(PROGRAM) |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 20 | |
| 21 | $(PROGRAM): $(OBJS) |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 22 | |
| 23 | clean: |
Julius Werner | c228bef | 2024-01-30 19:33:40 -0800 | [diff] [blame] | 24 | rm -f $(PROGRAM) $(OBJS:.c=.o) .dependencies *~ junit.xml |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 25 | |
Denis 'GNUtoo' Carikli | c2b5108 | 2015-11-11 05:40:11 +0100 | [diff] [blame] | 26 | install: $(PROGRAM) |
| 27 | $(INSTALL) -d $(DESTDIR)$(PREFIX)/sbin/ |
| 28 | $(INSTALL) cbmem $(DESTDIR)$(PREFIX)/sbin/ |
| 29 | |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 30 | distclean: clean |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 31 | |
Vadim Bendebury | 7c6b6bb | 2012-10-19 10:57:18 -0700 | [diff] [blame] | 32 | .dependencies: |
Stefan Tauner | e978fc2 | 2013-06-30 01:05:30 +0200 | [diff] [blame] | 33 | @$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .dependencies |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 34 | |
Martin Roth | 2ae8939 | 2021-02-14 15:04:12 -0700 | [diff] [blame] | 35 | help: |
| 36 | @echo "${PROGRAM}: View machine's cbmem contents" |
| 37 | @echo "Targets: all, clean, distclean, help, install" |
| 38 | @echo "To disable warnings as errors, run make as:" |
| 39 | @echo " make all WERROR=\"\"" |
| 40 | |
| 41 | .PHONY: all clean distclean install help |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 42 | |
| 43 | -include .dependencies |