arch/arm64: Support FEAT_CCIDX
[coreboot2.git] / util / nvramtool / Makefile
blob0d7f687f3bb1abd2d58eb2f07aa0ffd8909ea74c
1 ##
2 ## Makefile for nvram utility
3 ##
4 ## (C) 2005-2008 coresystems GmbH
5 ## written by Stefan Reinauer <stepan@coresystems.de>
6 ##
7 ## SPDX-License-Identifier: GPL-2.0-only
9 PROGRAM = nvramtool
11 CC ?= gcc
12 INSTALL = /usr/bin/env install
13 PREFIX = /usr/local
14 CFLAGS = -O2 -g -Wall -Wextra -Wmissing-prototypes -I. -DCMOS_HAL=1
15 #CFLAGS = -Os -Wall
17 CLI_OBJS = cli/nvramtool.o cli/opts.o
19 OBJS = cmos_lowlevel.o cmos_ops.o common.o compute_ip_checksum.o \
20 hexdump.o input_file.o layout.o accessors/layout-common.o accessors/layout-text.o accessors/layout-bin.o lbtable.o \
21 reg_expr.o cbfs.o accessors/cmos-hw-unix.o accessors/cmos-mem.o
23 OBJS += $(CLI_OBJS)
25 OS_ARCH = $(shell uname)
26 ifeq ($(OS_ARCH), Darwin)
27 LDFLAGS = -framework DirectHW
28 endif
29 ifeq ($(OS_ARCH),$(filter $(OS_ARCH),NetBSD OpenBSD))
30 LDFLAGS = -l$(shell uname -p)
31 endif
32 ifeq ($(shell uname -o 2>/dev/null), Cygwin)
33 LDFLAGS = -lioperm
34 CFLAGS += -D__GLIBC__
35 endif
37 all: dep $(PROGRAM)
39 $(PROGRAM): $(OBJS)
40 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS) $(CFLAGS)
42 clean:
43 rm -f $(PROGRAM) $(OBJS) junit.xml
45 distclean: clean
46 rm -f .dependencies
48 dep:
49 @$(CC) -MM -MG *.c > .dependencies
51 install: $(PROGRAM)
52 mkdir -p $(DESTDIR)$(PREFIX)/sbin
53 $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
54 mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
55 $(INSTALL) -p -m644 cli/$(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
57 .PHONY: all clean distclean dep
59 -include .dependencies