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 |
Jacob Garber | 0476332 | 2019-06-27 17:24:37 -0600 | [diff] [blame] | 10 | CFLAGS += -Wall -Wextra -Wmissing-prototypes -Werror |
Julius Werner | 98eeb96 | 2019-12-11 15:47:42 -0800 | [diff] [blame] | 11 | CPPFLAGS += -I . -I $(ROOT)/commonlib/include -I $(ROOT)/commonlib/bsd/include |
| 12 | CPPFLAGS += -include $(ROOT)/commonlib/bsd/include/commonlib/bsd/compiler.h |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 13 | |
| 14 | OBJS = $(PROGRAM).o |
| 15 | |
Vadim Bendebury | 7c6b6bb | 2012-10-19 10:57:18 -0700 | [diff] [blame] | 16 | all: $(PROGRAM) |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 17 | |
| 18 | $(PROGRAM): $(OBJS) |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 19 | |
| 20 | clean: |
Nico Huber | e3c05c4 | 2018-10-04 23:45:54 +0200 | [diff] [blame] | 21 | rm -f $(PROGRAM) *.o .dependencies *~ junit.xml |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 22 | |
Denis 'GNUtoo' Carikli | c2b5108 | 2015-11-11 05:40:11 +0100 | [diff] [blame] | 23 | install: $(PROGRAM) |
| 24 | $(INSTALL) -d $(DESTDIR)$(PREFIX)/sbin/ |
| 25 | $(INSTALL) cbmem $(DESTDIR)$(PREFIX)/sbin/ |
| 26 | |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 27 | distclean: clean |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 28 | |
Vadim Bendebury | 7c6b6bb | 2012-10-19 10:57:18 -0700 | [diff] [blame] | 29 | .dependencies: |
Stefan Tauner | e978fc2 | 2013-06-30 01:05:30 +0200 | [diff] [blame] | 30 | @$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .dependencies |
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 | .PHONY: all clean distclean |
Vadim Bendebury | 6d18fd0 | 2012-09-27 19:24:07 -0700 | [diff] [blame] | 33 | |
| 34 | -include .dependencies |