blob: a75c70da5ce6fe54bedb66e9c5f475f0eeef99b4 [file] [log] [blame]
Stefan Reinauer6559f432010-12-17 00:13:54 +00001##
2## Makefile for nvram utility
3##
4## (C) 2005-2008 coresystems GmbH
5## written by Stefan Reinauer <stepan@coresystems.de>
6##
7## This program is free software; you can redistribute it and/or modify
8## it under the terms of the GNU General Public License as published by
9## the Free Software Foundation; version 2 of the License.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program; if not, write to the Free Software
18## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19##
Stefan Reinauer6540ae52007-07-12 16:35:42 +000020
Stefan Reinauera67aab72008-09-27 10:08:28 +000021PROGRAM = nvramtool
Stefan Reinauer6540ae52007-07-12 16:35:42 +000022
Stefan Reinauera67aab72008-09-27 10:08:28 +000023CC = gcc
24STRIP = strip
25INSTALL = /usr/bin/install
26PREFIX = /usr/local
Patrick Georgic6d2b092011-01-28 07:47:10 +000027CFLAGS = -O2 -g -Wall -W -I.
Stefan Reinauera67aab72008-09-27 10:08:28 +000028#CFLAGS = -Os -Wall
Stefan Reinauer6540ae52007-07-12 16:35:42 +000029
Patrick Georgic6d2b092011-01-28 07:47:10 +000030CLI_OBJS = cli/nvramtool.o cli/opts.o
31
Stefan Reinauera67aab72008-09-27 10:08:28 +000032OBJS = cmos_lowlevel.o cmos_ops.o common.o compute_ip_checksum.o \
Patrick Georgi36ade672011-01-28 07:56:39 +000033 hexdump.o input_file.o layout.o accessors/layout-text.o accessors/layout-bin.o lbtable.o \
Patrick Georgi1e916e02011-01-28 07:54:11 +000034 reg_expr.o cbfs.o accessors/cmos-hw-unix.o accessors/cmos-mem.o
Patrick Georgic6d2b092011-01-28 07:47:10 +000035
36OBJS += $(CLI_OBJS)
Stefan Reinauer6540ae52007-07-12 16:35:42 +000037
Stefan Reinauer4db6cbd2009-09-01 09:54:21 +000038OS_ARCH = $(shell uname)
39ifeq ($(OS_ARCH), Darwin)
Stefan Reinauercff573d2011-03-18 22:08:39 +000040LDFLAGS = -framework DirectHW
Stefan Reinauer4db6cbd2009-09-01 09:54:21 +000041endif
jakllschb0c94a12011-02-08 16:07:49 +000042ifeq ($(OS_ARCH), NetBSD)
43LDFLAGS = -l$(shell uname -p)
44endif
Stefan Reinauer4db6cbd2009-09-01 09:54:21 +000045
Stefan Reinauera67aab72008-09-27 10:08:28 +000046all: dep $(PROGRAM)
Stefan Reinauer6540ae52007-07-12 16:35:42 +000047
Stefan Reinauera67aab72008-09-27 10:08:28 +000048$(PROGRAM): $(OBJS)
Rudolf Marek6e296652011-01-24 21:05:53 +000049 $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS) $(CFLAGS)
Stefan Reinauera67aab72008-09-27 10:08:28 +000050 $(STRIP) $(STRIP_ARGS) $(PROGRAM)
Stefan Reinauer6540ae52007-07-12 16:35:42 +000051
52clean:
Patrick Georgic6d2b092011-01-28 07:47:10 +000053 rm -f $(PROGRAM) $(OBJS)
Stefan Reinauer6540ae52007-07-12 16:35:42 +000054
Stefan Reinauera67aab72008-09-27 10:08:28 +000055distclean: clean
56 rm -f .dependencies
57
58dep:
59 @$(CC) -MM *.c > .dependencies
60
61install: $(PROGRAM)
Stefan Reinauer4db6cbd2009-09-01 09:54:21 +000062 mkdir -p $(DESTDIR)$(PREFIX)/sbin
63 $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
64 mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
Patrick Georgic6d2b092011-01-28 07:47:10 +000065 $(INSTALL) cli/$(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
Stefan Reinauera67aab72008-09-27 10:08:28 +000066
67.PHONY: all clean distclean dep
68
69-include .dependencies