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