Stefan Reinauer | 6559f43 | 2010-12-17 00:13:54 +0000 | [diff] [blame] | 1 | ## |
| 2 | ## Makefile for ectool |
| 3 | ## |
| 4 | ## Copyright (C) 2009 by 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 | ## |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 16 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 17 | CC = gcc |
Jacob Garber | 52f0e84 | 2019-07-19 12:27:27 -0600 | [diff] [blame] | 18 | CFLAGS = -O2 -Wall -Wextra |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 19 | PROGRAM = ectool |
Yegor Timoshenko | c2e4941 | 2018-10-07 01:58:27 +0000 | [diff] [blame] | 20 | INSTALL = /usr/bin/env install |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 21 | PREFIX = /usr/local |
Andrey Korolyov | 393d932 | 2016-01-05 14:27:59 +0300 | [diff] [blame] | 22 | OS_ARCH = $(shell uname) |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 23 | |
Andrey Korolyov | 393d932 | 2016-01-05 14:27:59 +0300 | [diff] [blame] | 24 | ifeq ($(shell uname -o 2>/dev/null), Cygwin) |
Raymond Danks | 51b8f05 | 2012-04-27 08:51:02 -0600 | [diff] [blame] | 25 | LDFLAGS = -lioperm |
| 26 | endif |
| 27 | |
Steven Dee | 3236f7b | 2017-01-29 14:52:56 -0500 | [diff] [blame] | 28 | ifeq ($(OS_ARCH), $(filter $(OS_ARCH), NetBSD OpenBSD)) |
Andrey Korolyov | 393d932 | 2016-01-05 14:27:59 +0300 | [diff] [blame] | 29 | LDFLAGS = -l$(shell uname -p) |
| 30 | endif |
| 31 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 32 | all: $(PROGRAM) |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 33 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 34 | $(PROGRAM): ec.o ectool.o |
Raymond Danks | 51b8f05 | 2012-04-27 08:51:02 -0600 | [diff] [blame] | 35 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 36 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 37 | install: $(PROGRAM) |
| 38 | $(INSTALL) $(PROGRAM) $(PREFIX)/sbin |
| 39 | |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 40 | clean: |
Martin Roth | 0be83c0 | 2015-10-21 14:50:00 -0600 | [diff] [blame] | 41 | rm -f *.o $(PROGRAM) junit.xml |
| 42 | |
| 43 | distclean: clean |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 44 | |
| 45 | %.o: %.c |
| 46 | $(CC) $(CFLAGS) -c $^ -I. -o $@ |
Martin Roth | 0be83c0 | 2015-10-21 14:50:00 -0600 | [diff] [blame] | 47 | |
| 48 | .PHONY: all install clean distclean |