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