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 |
Martin Roth | 0bb6290 | 2021-02-16 16:52:46 -0700 | [diff] [blame] | 4 | WERROR=-Werror |
| 5 | CFLAGS = -O2 -Wall -Wextra -Wshadow $(WERROR) |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 6 | PROGRAM = ectool |
Yegor Timoshenko | c2e4941 | 2018-10-07 01:58:27 +0000 | [diff] [blame] | 7 | INSTALL = /usr/bin/env install |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 8 | PREFIX = /usr/local |
Andrey Korolyov | 393d932 | 2016-01-05 14:27:59 +0300 | [diff] [blame] | 9 | OS_ARCH = $(shell uname) |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 10 | |
Andrey Korolyov | 393d932 | 2016-01-05 14:27:59 +0300 | [diff] [blame] | 11 | ifeq ($(shell uname -o 2>/dev/null), Cygwin) |
Raymond Danks | 51b8f05 | 2012-04-27 08:51:02 -0600 | [diff] [blame] | 12 | LDFLAGS = -lioperm |
| 13 | endif |
| 14 | |
Steven Dee | 3236f7b | 2017-01-29 14:52:56 -0500 | [diff] [blame] | 15 | ifeq ($(OS_ARCH), $(filter $(OS_ARCH), NetBSD OpenBSD)) |
Andrey Korolyov | 393d932 | 2016-01-05 14:27:59 +0300 | [diff] [blame] | 16 | LDFLAGS = -l$(shell uname -p) |
| 17 | endif |
| 18 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 19 | all: $(PROGRAM) |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 20 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 21 | $(PROGRAM): ec.o ectool.o |
Raymond Danks | 51b8f05 | 2012-04-27 08:51:02 -0600 | [diff] [blame] | 22 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 23 | |
Uwe Hermann | 424638e | 2009-04-23 22:22:47 +0000 | [diff] [blame] | 24 | install: $(PROGRAM) |
| 25 | $(INSTALL) $(PROGRAM) $(PREFIX)/sbin |
| 26 | |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 27 | clean: |
Martin Roth | 0be83c0 | 2015-10-21 14:50:00 -0600 | [diff] [blame] | 28 | rm -f *.o $(PROGRAM) junit.xml |
| 29 | |
| 30 | distclean: clean |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 31 | |
| 32 | %.o: %.c |
| 33 | $(CC) $(CFLAGS) -c $^ -I. -o $@ |
Martin Roth | 0be83c0 | 2015-10-21 14:50:00 -0600 | [diff] [blame] | 34 | |
Martin Roth | 0bb6290 | 2021-02-16 16:52:46 -0700 | [diff] [blame] | 35 | help: |
| 36 | @echo "${PROGRAM}: Dump RAM of Embedded Controller (EC)" |
| 37 | @echo "Targets: all, clean, distclean, help, install" |
| 38 | @echo "To disable warnings as errors, run make as:" |
| 39 | @echo " make all WERROR=\"\"" |
| 40 | |
| 41 | .PHONY: all clean distclean help install |