blob: 8aa1415a564ebe2be761612d84da852792f70ac6 [file] [log] [blame]
Stefan Reinauer6559f432010-12-17 00:13:54 +00001##
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 Reinauerb5ab3232009-04-22 07:23:00 +000016
Uwe Hermann424638e2009-04-23 22:22:47 +000017CC = gcc
18CFLAGS = -O2 -Wall -W
19PROGRAM = ectool
20INSTALL = /usr/bin/install
21PREFIX = /usr/local
Andrey Korolyov393d9322016-01-05 14:27:59 +030022OS_ARCH = $(shell uname)
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000023
Andrey Korolyov393d9322016-01-05 14:27:59 +030024ifeq ($(shell uname -o 2>/dev/null), Cygwin)
Raymond Danks51b8f052012-04-27 08:51:02 -060025LDFLAGS = -lioperm
26endif
27
Andrey Korolyov393d9322016-01-05 14:27:59 +030028ifeq ($(OS_ARCH), NetBSD)
29LDFLAGS = -l$(shell uname -p)
30endif
31
Uwe Hermann424638e2009-04-23 22:22:47 +000032all: $(PROGRAM)
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000033
Uwe Hermann424638e2009-04-23 22:22:47 +000034$(PROGRAM): ec.o ectool.o
Raymond Danks51b8f052012-04-27 08:51:02 -060035 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
Uwe Hermann257ae3f2009-04-22 12:28:14 +000036
Uwe Hermann424638e2009-04-23 22:22:47 +000037install: $(PROGRAM)
38 $(INSTALL) $(PROGRAM) $(PREFIX)/sbin
39
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000040clean:
Martin Roth0be83c02015-10-21 14:50:00 -060041 rm -f *.o $(PROGRAM) junit.xml
42
43distclean: clean
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000044
45%.o: %.c
46 $(CC) $(CFLAGS) -c $^ -I. -o $@
Martin Roth0be83c02015-10-21 14:50:00 -060047
48.PHONY: all install clean distclean