blob: 9219a08f3c032e379c83a8baaf5f5196f5840458 [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
Werner Zeh1c727fd2022-11-16 10:58:35 +01005TOP ?= $(abspath ../..)
6ROOT = $(TOP)/src
Denis 'GNUtoo' Cariklic2b51082015-11-11 05:40:11 +01007CC ?= $(CROSS_COMPILE)gcc
Yegor Timoshenkoc2e49412018-10-07 01:58:27 +00008INSTALL ?= /usr/bin/env install
Denis 'GNUtoo' Cariklic2b51082015-11-11 05:40:11 +01009PREFIX ?= /usr/local
10CFLAGS ?= -O2
Martin Roth2ae89392021-02-14 15:04:12 -070011WERROR=-Werror
12CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wshadow $(WERROR)
Julius Werner98eeb962019-12-11 15:47:42 -080013CPPFLAGS += -I . -I $(ROOT)/commonlib/include -I $(ROOT)/commonlib/bsd/include
14CPPFLAGS += -include $(ROOT)/commonlib/bsd/include/commonlib/bsd/compiler.h
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070015
16OBJS = $(PROGRAM).o
17
Vadim Bendebury7c6b6bb2012-10-19 10:57:18 -070018all: $(PROGRAM)
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070019
20$(PROGRAM): $(OBJS)
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070021
22clean:
Nico Hubere3c05c42018-10-04 23:45:54 +020023 rm -f $(PROGRAM) *.o .dependencies *~ junit.xml
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070024
Denis 'GNUtoo' Cariklic2b51082015-11-11 05:40:11 +010025install: $(PROGRAM)
26 $(INSTALL) -d $(DESTDIR)$(PREFIX)/sbin/
27 $(INSTALL) cbmem $(DESTDIR)$(PREFIX)/sbin/
28
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070029distclean: clean
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070030
Vadim Bendebury7c6b6bb2012-10-19 10:57:18 -070031.dependencies:
Stefan Taunere978fc22013-06-30 01:05:30 +020032 @$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .dependencies
Vadim Bendebury6d18fd02012-09-27 19:24:07 -070033
Martin Roth2ae89392021-02-14 15:04:12 -070034help:
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 Bendebury6d18fd02012-09-27 19:24:07 -070041
42-include .dependencies