blob: 00a1cc0d7b7fa7c22c32668e6e39c09da53e0f69 [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##
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##
20
21PROGRAM = superiotool
22
23CC = gcc
24INSTALL = /usr/bin/install
25PREFIX = /usr/local
26
Ulf Jordan39a5bf72007-10-13 18:06:12 +000027# Set the superiotool version string from the highest revision number
28# of the checked out superiotool files.
29SVNDEF := -D'SUPERIOTOOL_VERSION="$(shell svnversion -cn . \
30 | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/")"'
31
Anders Juel Jensen280275d2010-08-22 19:39:04 +000032CFLAGS += -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \
Uwe Hermann969a9f62008-03-17 13:43:48 +000033 -Werror-implicit-function-declaration -ansi -pedantic $(SVNDEF)
Anders Juel Jensen280275d2010-08-22 19:39:04 +000034LDFLAGS += -lz
Uwe Hermann1ae8e832007-09-01 20:20:41 +000035
David Hendrickse1822d92010-07-22 22:56:44 +000036OBJS = superiotool.o ali.o fintek.o ite.o nsc.o nuvoton.o smsc.o winbond.o
Uwe Hermann0120e1a2007-09-16 18:11:03 +000037
Stefan Reinauere95eb612009-09-01 09:57:55 +000038OS_ARCH = $(shell uname)
39ifeq ($(OS_ARCH), Darwin)
Stefan Reinauercff573d2011-03-18 22:08:39 +000040LIBS = -framework IOKit -framework DirectHW -lpci -lz
Stefan Reinauere95eb612009-09-01 09:57:55 +000041endif
Idwer Volleringa4d77dc2010-10-24 13:42:32 +000042ifeq ($(OS_ARCH), FreeBSD)
43CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \
44 -Werror-implicit-function-declaration -ansi $(SVNDEF) \
45 -I/usr/local/include
46LDFLAGS += -L/usr/local/lib
47LIBS = -lz
48endif
Jonathan Kollasch51ac8382010-10-24 14:10:35 +000049ifeq ($(OS_ARCH), NetBSD)
50LDFLAGS = -l$(shell uname -p)
51endif
Stefan Reinauere95eb612009-09-01 09:57:55 +000052
Carl-Daniel Hailfingerbb38f322010-01-24 01:40:46 +000053# Support for PCI-attached "Super I/Os" (e.g. in VIA VT82686A/B).
54CONFIG_PCI = yes
55
56ifeq ($(CONFIG_PCI), yes)
57CFLAGS += -DPCI_SUPPORT
Christian Ruppert121f0b82010-03-21 21:22:51 +000058LIBS += -lpci
Carl-Daniel Hailfingerbb38f322010-01-24 01:40:46 +000059OBJS += pci.o via.o
60endif
61
Uwe Hermann1ae8e832007-09-01 20:20:41 +000062all: $(PROGRAM)
63
Ulf Jordan39a5bf72007-10-13 18:06:12 +000064superiotool.o: *.c superiotool.h
65
Uwe Hermannd754d2c2007-09-18 23:30:24 +000066$(PROGRAM): $(OBJS) superiotool.h
Christian Ruppert121f0b82010-03-21 21:22:51 +000067 $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
Uwe Hermann1ae8e832007-09-01 20:20:41 +000068
69install: $(PROGRAM)
Stefan Reinauere95eb612009-09-01 09:57:55 +000070 mkdir -p $(DESTDIR)$(PREFIX)/sbin
71 $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
72 mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
73 $(INSTALL) $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
Uwe Hermann1ae8e832007-09-01 20:20:41 +000074
Stefan Reinauer6a5bc462007-01-17 10:57:42 +000075clean:
Uwe Hermann0120e1a2007-09-16 18:11:03 +000076 rm -f $(PROGRAM) *.o
Uwe Hermann1ae8e832007-09-01 20:20:41 +000077
78.PHONY: all install clean
79