blob: a1708755741de41734919b81a7d875dafe46aa58 [file] [log] [blame]
Vadim Bendebury6d18fd02012-09-27 19:24:07 -07001##
Patrick Georgi7333a112020-05-08 20:48:04 +02002## SPDX-License-Identifier: GPL-2.0-only
Vadim Bendebury6d18fd02012-09-27 19:24:07 -07003
Denis 'GNUtoo' Cariklic2b51082015-11-11 05:40:11 +01004PROGRAM = cbmem
5ROOT = ../../src
6CC ?= $(CROSS_COMPILE)gcc
Yegor Timoshenkoc2e49412018-10-07 01:58:27 +00007INSTALL ?= /usr/bin/env install
Denis 'GNUtoo' Cariklic2b51082015-11-11 05:40:11 +01008PREFIX ?= /usr/local
9CFLAGS ?= -O2
Martin Roth2ae89392021-02-14 15:04:12 -070010WERROR=-Werror
11CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wshadow $(WERROR)
Julius Werner98eeb962019-12-11 15:47:42 -080012CPPFLAGS += -I . -I $(ROOT)/commonlib/include -I $(ROOT)/commonlib/bsd/include
13CPPFLAGS += -include $(ROOT)/commonlib/bsd/include/commonlib/bsd/compiler.h
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070014
15OBJS = $(PROGRAM).o
16
Vadim Bendebury7c6b6bb2012-10-19 10:57:18 -070017all: $(PROGRAM)
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070018
19$(PROGRAM): $(OBJS)
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070020
21clean:
Nico Hubere3c05c42018-10-04 23:45:54 +020022 rm -f $(PROGRAM) *.o .dependencies *~ junit.xml
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070023
Denis 'GNUtoo' Cariklic2b51082015-11-11 05:40:11 +010024install: $(PROGRAM)
25 $(INSTALL) -d $(DESTDIR)$(PREFIX)/sbin/
26 $(INSTALL) cbmem $(DESTDIR)$(PREFIX)/sbin/
27
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070028distclean: clean
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070029
Vadim Bendebury7c6b6bb2012-10-19 10:57:18 -070030.dependencies:
Stefan Taunere978fc22013-06-30 01:05:30 +020031 @$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .dependencies
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070032
Martin Roth2ae89392021-02-14 15:04:12 -070033help:
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 Bendebury6d18fd02012-09-27 19:24:07 -070040
41-include .dependencies