blob: f6d9685585ac930d4a0d8f1b9804313488574a5d [file] [log] [blame]
Uwe Hermann1ae8e832007-09-01 20:20:41 +00001##
Uwe Hermannafe83092007-09-28 15:45:43 +00002## This file is part of the superiotool project.
Uwe Hermann1ae8e832007-09-01 20:20:41 +00003##
Carl-Daniel Hailfingerbb38f322010-01-24 01:40:46 +00004## Copyright (C) 2007-2010 Uwe Hermann <uwe@hermann-uwe.de>
Uwe Hermann1ae8e832007-09-01 20:20:41 +00005##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 2 of the License, or
9## (at your option) any later version.
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##
Uwe Hermann1ae8e832007-09-01 20:20:41 +000016
17PROGRAM = superiotool
18
Paul Menzelbe2c6342013-03-28 11:44:19 +010019CC ?= gcc
20INSTALL ?= /usr/bin/install
21PREFIX ?= /usr/local
Uwe Hermann1ae8e832007-09-01 20:20:41 +000022
Guenter Roeck3397cef2012-06-29 12:25:46 -070023# Set the superiotool version string to the output of 'git describe'.
24
25VERSION := -D'SUPERIOTOOL_VERSION="$(shell git describe 2>/dev/null)"'
Ulf Jordan39a5bf72007-10-13 18:06:12 +000026
Mathias Krause14b67f72011-03-09 11:37:16 +010027CFLAGS += -O2 -Wall -Wstrict-prototypes -Wundef -Wstrict-aliasing \
Guenter Roeck3397cef2012-06-29 12:25:46 -070028 -Werror-implicit-function-declaration -ansi -pedantic $(VERSION)
Anders Juel Jensen280275d2010-08-22 19:39:04 +000029LDFLAGS += -lz
Uwe Hermann1ae8e832007-09-01 20:20:41 +000030
Derek Waldner3b421192016-04-14 12:13:48 -050031OBJS = superiotool.o serverengines.o ali.o exar.o fintek.o ite.o nsc.o \
32 nuvoton.o smsc.o winbond.o infineon.o
Uwe Hermann0120e1a2007-09-16 18:11:03 +000033
Stefan Reinauere95eb612009-09-01 09:57:55 +000034OS_ARCH = $(shell uname)
35ifeq ($(OS_ARCH), Darwin)
Stefan Reinauercff573d2011-03-18 22:08:39 +000036LIBS = -framework IOKit -framework DirectHW -lpci -lz
Stefan Reinauere95eb612009-09-01 09:57:55 +000037endif
Idwer Volleringa4d77dc2010-10-24 13:42:32 +000038ifeq ($(OS_ARCH), FreeBSD)
39CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \
Andriy Gapon89397fc2012-10-03 08:19:34 +020040 -Werror-implicit-function-declaration -ansi $(VERSION) \
Idwer Volleringa4d77dc2010-10-24 13:42:32 +000041 -I/usr/local/include
42LDFLAGS += -L/usr/local/lib
43LIBS = -lz
44endif
Jonathan Kollasch51ac8382010-10-24 14:10:35 +000045ifeq ($(OS_ARCH), NetBSD)
Andrey Korolyovdecefea2016-01-04 02:20:04 +030046CFLAGS += -I/usr/pkg/include
47LDFLAGS += -L/usr/pkg/lib -Wl,-rpath-link,/usr/pkg/lib
48LIBS = -lz -l$(shell uname -p)
Jonathan Kollasch51ac8382010-10-24 14:10:35 +000049endif
Stefan Reinauere95eb612009-09-01 09:57:55 +000050
Carl-Daniel Hailfingerbb38f322010-01-24 01:40:46 +000051# Support for PCI-attached "Super I/Os" (e.g. in VIA VT82686A/B).
52CONFIG_PCI = yes
53
54ifeq ($(CONFIG_PCI), yes)
55CFLAGS += -DPCI_SUPPORT
Rudolf Marek113c3492011-10-27 20:42:11 +020056OBJS += pci.o via.o amd.o
Andrey Korolyovdecefea2016-01-04 02:20:04 +030057LIBS += -lpci
58ifeq ($(OS_ARCH),NetBSD)
59LIBS += -lpciutils
60endif
Carl-Daniel Hailfingerbb38f322010-01-24 01:40:46 +000061endif
62
Uwe Hermann1ae8e832007-09-01 20:20:41 +000063all: $(PROGRAM)
64
Ulf Jordan39a5bf72007-10-13 18:06:12 +000065superiotool.o: *.c superiotool.h
66
Uwe Hermannd754d2c2007-09-18 23:30:24 +000067$(PROGRAM): $(OBJS) superiotool.h
Christian Ruppert121f0b82010-03-21 21:22:51 +000068 $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
Uwe Hermann1ae8e832007-09-01 20:20:41 +000069
70install: $(PROGRAM)
Stefan Reinauere95eb612009-09-01 09:57:55 +000071 mkdir -p $(DESTDIR)$(PREFIX)/sbin
72 $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
73 mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
Lubomir Rintelba1f9aa2014-01-28 16:52:48 +000074 $(INSTALL) -p -m644 $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
Uwe Hermann1ae8e832007-09-01 20:20:41 +000075
Stefan Reinauer6a5bc462007-01-17 10:57:42 +000076clean:
Martin Roth0be83c02015-10-21 14:50:00 -060077 rm -f $(PROGRAM) *.o junit.xml
Uwe Hermann1ae8e832007-09-01 20:20:41 +000078
Martin Roth0be83c02015-10-21 14:50:00 -060079distclean: clean
80
81.PHONY: all install clean distclean