Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 1 | ## SPDX-License-Identifier: GPL-2.0-only |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 2 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 3 | CC = gcc |
Jacob Garber | 52f0e84 | 2019-07-19 12:27:27 -0600 | [diff] [blame] | 4 | CFLAGS = -O2 -Wall -Wextra |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 5 | PROGRAM = ectool |
Yegor Timoshenko | c2e4941 | 2018-10-07 01:58:27 +0000 | [diff] [blame] | 6 | INSTALL = /usr/bin/env install |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 7 | PREFIX = /usr/local |
Andrey Korolyov | 393d932 | 2016-01-05 14:27:59 +0300 | [diff] [blame] | 8 | OS_ARCH = $(shell uname) |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 9 | |
Andrey Korolyov | 393d932 | 2016-01-05 14:27:59 +0300 | [diff] [blame] | 10 | ifeq ($(shell uname -o 2>/dev/null), Cygwin) |
Raymond Danks | 51b8f05 | 2012-04-27 08:51:02 -0600 | [diff] [blame] | 11 | LDFLAGS = -lioperm |
12 | endif | ||||
13 | |||||
Steven Dee | 3236f7b | 2017-01-29 14:52:56 -0500 | [diff] [blame] | 14 | ifeq ($(OS_ARCH), $(filter $(OS_ARCH), NetBSD OpenBSD)) |
Andrey Korolyov | 393d932 | 2016-01-05 14:27:59 +0300 | [diff] [blame] | 15 | LDFLAGS = -l$(shell uname -p) |
16 | endif | ||||
17 | |||||
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 18 | all: $(PROGRAM) |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 19 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 20 | $(PROGRAM): ec.o ectool.o |
Raymond Danks | 51b8f05 | 2012-04-27 08:51:02 -0600 | [diff] [blame] | 21 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 22 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 23 | install: $(PROGRAM) |
24 | $(INSTALL) $(PROGRAM) $(PREFIX)/sbin | ||||
25 | |||||
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 26 | clean: |
Martin Roth | 0be83c0 | 2015-10-21 14:50:00 -0600 | [diff] [blame] | 27 | rm -f *.o $(PROGRAM) junit.xml |
28 | |||||
29 | distclean: clean | ||||
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 30 | |
31 | %.o: %.c | ||||
32 | $(CC) $(CFLAGS) -c $^ -I. -o $@ | ||||
Martin Roth | 0be83c0 | 2015-10-21 14:50:00 -0600 | [diff] [blame] | 33 | |
34 | .PHONY: all install clean distclean |