diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-06-19 16:41:11 -0400 |
|---|---|---|
| committer | Linus Walleij <linus.walleij@linaro.org> | 2016-06-23 05:07:13 -0400 |
| commit | 8674cea84dc6c0b98d8f45d6f2cf348864aabf1b (patch) | |
| tree | 8c6443596936ff2eead94a4ef52fc9ed95ca20a7 /tools/gpio | |
| parent | dd3b204af11b50be6dc77e18b88b3c646bba354c (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/Build | 3 | ||||
| -rw-r--r-- | tools/gpio/Makefile | 69 |
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 @@ | |||
| 1 | lsgpio-y += lsgpio.o gpio-utils.o | ||
| 2 | gpio-hammer-y += gpio-hammer.o gpio-utils.o | ||
| 3 | gpio-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 @@ | |||
| 1 | include ../scripts/Makefile.include | ||
| 2 | |||
| 3 | ifeq ($(srctree),) | ||
| 4 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) | ||
| 5 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
| 6 | endif | ||
| 7 | |||
| 8 | # Do not use make's built-in rules | ||
| 9 | # (this improves performance and avoids hard-to-debug behaviour); | ||
| 10 | MAKEFLAGS += -r | ||
| 11 | |||
| 1 | CC = $(CROSS_COMPILE)gcc | 12 | CC = $(CROSS_COMPILE)gcc |
| 2 | CFLAGS += -O2 -Wall -g -D_GNU_SOURCE | 13 | LD = $(CROSS_COMPILE)ld |
| 14 | CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include | ||
| 15 | |||
| 16 | ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon | ||
| 17 | ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) | ||
| 18 | |||
| 19 | all: $(ALL_PROGRAMS) | ||
| 3 | 20 | ||
| 4 | all: lsgpio gpio-hammer gpio-event-mon | 21 | export srctree OUTPUT CC LD CFLAGS |
| 22 | include $(srctree)/tools/build/Makefile.include | ||
| 5 | 23 | ||
| 6 | lsgpio: lsgpio.o gpio-utils.o | 24 | # |
| 7 | gpio-hammer: gpio-hammer.o gpio-utils.o | 25 | # We need the following to be outside of kernel tree |
| 8 | gpio-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 | 31 | prepare: $(OUTPUT)include/linux/gpio.h |
| 32 | |||
| 33 | # | ||
| 34 | # lsgpio | ||
| 35 | # | ||
| 36 | LSGPIO_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 | # | ||
| 45 | GPIO_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 | # | ||
| 54 | GPIO_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 | ||
| 13 | clean: | 60 | clean: |
| 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 | |||
| 65 | FORCE: | ||
| 66 | |||
| 67 | .PHONY: all clean FORCE prepare | ||
