aboutsummaryrefslogtreecommitdiffstats
path: root/tools/gpio
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2016-06-19 16:41:11 -0400
committerLinus Walleij <linus.walleij@linaro.org>2016-06-23 05:07:13 -0400
commit8674cea84dc6c0b98d8f45d6f2cf348864aabf1b (patch)
tree8c6443596936ff2eead94a4ef52fc9ed95ca20a7 /tools/gpio
parentdd3b204af11b50be6dc77e18b88b3c646bba354c (diff)
tools/gpio: move to tools buildsystem
There is a nice buildsystem dedicated for userspace tools in Linux kernel tree. Switch gpio target to be built by it. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Alexandre Courbot <acourbot@nvidia.com> Tested-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'tools/gpio')
-rw-r--r--tools/gpio/Build3
-rw-r--r--tools/gpio/Makefile69
2 files changed, 64 insertions, 8 deletions
diff --git a/tools/gpio/Build b/tools/gpio/Build
new file mode 100644
index 000000000000..620c1937d957
--- /dev/null
+++ b/tools/gpio/Build
@@ -0,0 +1,3 @@
1lsgpio-y += lsgpio.o gpio-utils.o
2gpio-hammer-y += gpio-hammer.o gpio-utils.o
3gpio-event-mon-y += gpio-event-mon.o gpio-utils.o
diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
index 619314ff9bd6..5a82f15d0071 100644
--- a/tools/gpio/Makefile
+++ b/tools/gpio/Makefile
@@ -1,14 +1,67 @@
1include ../scripts/Makefile.include
2
3ifeq ($(srctree),)
4srctree := $(patsubst %/,%,$(dir $(shell pwd)))
5srctree := $(patsubst %/,%,$(dir $(srctree)))
6endif
7
8# Do not use make's built-in rules
9# (this improves performance and avoids hard-to-debug behaviour);
10MAKEFLAGS += -r
11
1CC = $(CROSS_COMPILE)gcc 12CC = $(CROSS_COMPILE)gcc
2CFLAGS += -O2 -Wall -g -D_GNU_SOURCE 13LD = $(CROSS_COMPILE)ld
14CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
15
16ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon
17ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
18
19all: $(ALL_PROGRAMS)
3 20
4all: lsgpio gpio-hammer gpio-event-mon 21export srctree OUTPUT CC LD CFLAGS
22include $(srctree)/tools/build/Makefile.include
5 23
6lsgpio: lsgpio.o gpio-utils.o 24#
7gpio-hammer: gpio-hammer.o gpio-utils.o 25# We need the following to be outside of kernel tree
8gpio-event-mon: gpio-event-mon.o gpio-utils.o 26#
27$(OUTPUT)include/linux/gpio.h: ../../include/uapi/linux/gpio.h
28 mkdir -p $(OUTPUT)include/linux 2>&1 || true
29 ln -sf $(CURDIR)/../../include/uapi/linux/gpio.h $@
9 30
10%.o: %.c gpio-utils.h 31prepare: $(OUTPUT)include/linux/gpio.h
32
33#
34# lsgpio
35#
36LSGPIO_IN := $(OUTPUT)lsgpio-in.o
37$(LSGPIO_IN): prepare FORCE
38 $(Q)$(MAKE) $(build)=lsgpio
39$(OUTPUT)lsgpio: $(LSGPIO_IN)
40 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
41
42#
43# gpio-hammer
44#
45GPIO_HAMMER_IN := $(OUTPUT)gpio-hammer-in.o
46$(GPIO_HAMMER_IN): prepare FORCE
47 $(Q)$(MAKE) $(build)=gpio-hammer
48$(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN)
49 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
50
51#
52# gpio-event-mon
53#
54GPIO_EVENT_MON_IN := $(OUTPUT)gpio-event-mon-in.o
55$(GPIO_EVENT_MON_IN): prepare FORCE
56 $(Q)$(MAKE) $(build)=gpio-event-mon
57$(OUTPUT)gpio-event-mon: $(GPIO_EVENT_MON_IN)
58 $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
11 59
12.PHONY: clean
13clean: 60clean:
14 rm -f *.o lsgpio gpio-hammer gpio-event-mon 61 rm -f $(ALL_PROGRAMS)
62 rm -f $(OUTPUT)include/linux/gpio.h
63 find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
64
65FORCE:
66
67.PHONY: all clean FORCE prepare