Uwe Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 1 | ## |
Uwe Hermann | afe8309 | 2007-09-28 15:45:43 +0000 | [diff] [blame] | 2 | ## This file is part of the superiotool project. |
Uwe Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 3 | ## |
Carl-Daniel Hailfinger | bb38f32 | 2010-01-24 01:40:46 +0000 | [diff] [blame] | 4 | ## Copyright (C) 2007-2010 Uwe Hermann <uwe@hermann-uwe.de> |
Uwe Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 5 | ## |
| 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 Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 16 | |
| 17 | PROGRAM = superiotool |
| 18 | |
Paul Menzel | be2c634 | 2013-03-28 11:44:19 +0100 | [diff] [blame] | 19 | CC ?= gcc |
| 20 | INSTALL ?= /usr/bin/install |
| 21 | PREFIX ?= /usr/local |
Uwe Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 22 | |
Guenter Roeck | 3397cef | 2012-06-29 12:25:46 -0700 | [diff] [blame] | 23 | # Set the superiotool version string to the output of 'git describe'. |
| 24 | |
| 25 | VERSION := -D'SUPERIOTOOL_VERSION="$(shell git describe 2>/dev/null)"' |
Ulf Jordan | 39a5bf7 | 2007-10-13 18:06:12 +0000 | [diff] [blame] | 26 | |
Mathias Krause | 14b67f7 | 2011-03-09 11:37:16 +0100 | [diff] [blame] | 27 | CFLAGS += -O2 -Wall -Wstrict-prototypes -Wundef -Wstrict-aliasing \ |
Guenter Roeck | 3397cef | 2012-06-29 12:25:46 -0700 | [diff] [blame] | 28 | -Werror-implicit-function-declaration -ansi -pedantic $(VERSION) |
Anders Juel Jensen | 280275d | 2010-08-22 19:39:04 +0000 | [diff] [blame] | 29 | LDFLAGS += -lz |
Uwe Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 30 | |
Derek Waldner | 3b42119 | 2016-04-14 12:13:48 -0500 | [diff] [blame] | 31 | OBJS = superiotool.o serverengines.o ali.o exar.o fintek.o ite.o nsc.o \ |
| 32 | nuvoton.o smsc.o winbond.o infineon.o |
Uwe Hermann | 0120e1a | 2007-09-16 18:11:03 +0000 | [diff] [blame] | 33 | |
Stefan Reinauer | e95eb61 | 2009-09-01 09:57:55 +0000 | [diff] [blame] | 34 | OS_ARCH = $(shell uname) |
| 35 | ifeq ($(OS_ARCH), Darwin) |
Stefan Reinauer | cff573d | 2011-03-18 22:08:39 +0000 | [diff] [blame] | 36 | LIBS = -framework IOKit -framework DirectHW -lpci -lz |
Stefan Reinauer | e95eb61 | 2009-09-01 09:57:55 +0000 | [diff] [blame] | 37 | endif |
Idwer Vollering | a4d77dc | 2010-10-24 13:42:32 +0000 | [diff] [blame] | 38 | ifeq ($(OS_ARCH), FreeBSD) |
| 39 | CFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -Wundef -Wstrict-aliasing \ |
Andriy Gapon | 89397fc | 2012-10-03 08:19:34 +0200 | [diff] [blame] | 40 | -Werror-implicit-function-declaration -ansi $(VERSION) \ |
Idwer Vollering | a4d77dc | 2010-10-24 13:42:32 +0000 | [diff] [blame] | 41 | -I/usr/local/include |
| 42 | LDFLAGS += -L/usr/local/lib |
| 43 | LIBS = -lz |
| 44 | endif |
Jonathan Kollasch | 51ac838 | 2010-10-24 14:10:35 +0000 | [diff] [blame] | 45 | ifeq ($(OS_ARCH), NetBSD) |
Andrey Korolyov | decefea | 2016-01-04 02:20:04 +0300 | [diff] [blame] | 46 | CFLAGS += -I/usr/pkg/include |
| 47 | LDFLAGS += -L/usr/pkg/lib -Wl,-rpath-link,/usr/pkg/lib |
| 48 | LIBS = -lz -l$(shell uname -p) |
Jonathan Kollasch | 51ac838 | 2010-10-24 14:10:35 +0000 | [diff] [blame] | 49 | endif |
Stefan Reinauer | e95eb61 | 2009-09-01 09:57:55 +0000 | [diff] [blame] | 50 | |
Carl-Daniel Hailfinger | bb38f32 | 2010-01-24 01:40:46 +0000 | [diff] [blame] | 51 | # Support for PCI-attached "Super I/Os" (e.g. in VIA VT82686A/B). |
| 52 | CONFIG_PCI = yes |
| 53 | |
| 54 | ifeq ($(CONFIG_PCI), yes) |
| 55 | CFLAGS += -DPCI_SUPPORT |
Rudolf Marek | 113c349 | 2011-10-27 20:42:11 +0200 | [diff] [blame] | 56 | OBJS += pci.o via.o amd.o |
Andrey Korolyov | decefea | 2016-01-04 02:20:04 +0300 | [diff] [blame] | 57 | LIBS += -lpci |
| 58 | ifeq ($(OS_ARCH),NetBSD) |
| 59 | LIBS += -lpciutils |
| 60 | endif |
Carl-Daniel Hailfinger | bb38f32 | 2010-01-24 01:40:46 +0000 | [diff] [blame] | 61 | endif |
| 62 | |
Uwe Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 63 | all: $(PROGRAM) |
| 64 | |
Ulf Jordan | 39a5bf7 | 2007-10-13 18:06:12 +0000 | [diff] [blame] | 65 | superiotool.o: *.c superiotool.h |
| 66 | |
Uwe Hermann | d754d2c | 2007-09-18 23:30:24 +0000 | [diff] [blame] | 67 | $(PROGRAM): $(OBJS) superiotool.h |
Christian Ruppert | 121f0b8 | 2010-03-21 21:22:51 +0000 | [diff] [blame] | 68 | $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS) |
Uwe Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 69 | |
| 70 | install: $(PROGRAM) |
Stefan Reinauer | e95eb61 | 2009-09-01 09:57:55 +0000 | [diff] [blame] | 71 | mkdir -p $(DESTDIR)$(PREFIX)/sbin |
| 72 | $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin |
| 73 | mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8 |
Lubomir Rintel | ba1f9aa | 2014-01-28 16:52:48 +0000 | [diff] [blame] | 74 | $(INSTALL) -p -m644 $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8 |
Uwe Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 75 | |
Stefan Reinauer | 6a5bc46 | 2007-01-17 10:57:42 +0000 | [diff] [blame] | 76 | clean: |
Martin Roth | 0be83c0 | 2015-10-21 14:50:00 -0600 | [diff] [blame] | 77 | rm -f $(PROGRAM) *.o junit.xml |
Uwe Hermann | 1ae8e83 | 2007-09-01 20:20:41 +0000 | [diff] [blame] | 78 | |
Martin Roth | 0be83c0 | 2015-10-21 14:50:00 -0600 | [diff] [blame] | 79 | distclean: clean |
| 80 | |
| 81 | .PHONY: all install clean distclean |