Blame view

tools/iio/Makefile 2.06 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  # SPDX-License-Identifier: GPL-2.0
18956cf2d   Andy Shevchenko   iio: tools: move ...
2
  include ../scripts/Makefile.include
25e3f85aa   Andy Shevchenko   iio: tools: add i...
3
  bindir ?= /usr/bin
18956cf2d   Andy Shevchenko   iio: tools: move ...
4
5
6
7
8
9
10
11
  ifeq ($(srctree),)
  srctree := $(patsubst %/,%,$(dir $(CURDIR)))
  srctree := $(patsubst %/,%,$(dir $(srctree)))
  endif
  
  # Do not use make's built-in rules
  # (this improves performance and avoids hard-to-debug behaviour);
  MAKEFLAGS += -r
572974610   Jiri Olsa   tools iio: Overri...
12
  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
817020cfb   Roberta Dobrescu   iio: Move iio use...
13

18956cf2d   Andy Shevchenko   iio: tools: move ...
14
15
  ALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer
  ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
0c4b65002   Peter Robinson   tools: iio: Add a...
16

18956cf2d   Andy Shevchenko   iio: tools: move ...
17
  all: $(ALL_PROGRAMS)
817020cfb   Roberta Dobrescu   iio: Move iio use...
18

18956cf2d   Andy Shevchenko   iio: tools: move ...
19
20
  export srctree OUTPUT CC LD CFLAGS
  include $(srctree)/tools/build/Makefile.include
817020cfb   Roberta Dobrescu   iio: Move iio use...
21

18956cf2d   Andy Shevchenko   iio: tools: move ...
22
23
24
25
26
27
28
  #
  # We need the following to be outside of kernel tree
  #
  $(OUTPUT)include/linux/iio: ../../include/uapi/linux/iio
  	mkdir -p $(OUTPUT)include/linux/iio 2>&1 || true
  	ln -sf $(CURDIR)/../../include/uapi/linux/iio/events.h $@
  	ln -sf $(CURDIR)/../../include/uapi/linux/iio/types.h $@
817020cfb   Roberta Dobrescu   iio: Move iio use...
29

18956cf2d   Andy Shevchenko   iio: tools: move ...
30
  prepare: $(OUTPUT)include/linux/iio
817020cfb   Roberta Dobrescu   iio: Move iio use...
31

731b60afc   Laura Abbott   tools: iio: Corre...
32
33
34
  IIO_UTILS_IN := $(OUTPUT)iio_utils-in.o
  $(IIO_UTILS_IN): prepare FORCE
  	$(Q)$(MAKE) $(build)=iio_utils
18956cf2d   Andy Shevchenko   iio: tools: move ...
35
  LSIIO_IN := $(OUTPUT)lsiio-in.o
731b60afc   Laura Abbott   tools: iio: Corre...
36
  $(LSIIO_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
18956cf2d   Andy Shevchenko   iio: tools: move ...
37
38
39
  	$(Q)$(MAKE) $(build)=lsiio
  $(OUTPUT)lsiio: $(LSIIO_IN)
  	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
817020cfb   Roberta Dobrescu   iio: Move iio use...
40

18956cf2d   Andy Shevchenko   iio: tools: move ...
41
  IIO_EVENT_MONITOR_IN := $(OUTPUT)iio_event_monitor-in.o
731b60afc   Laura Abbott   tools: iio: Corre...
42
  $(IIO_EVENT_MONITOR_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
18956cf2d   Andy Shevchenko   iio: tools: move ...
43
44
45
  	$(Q)$(MAKE) $(build)=iio_event_monitor
  $(OUTPUT)iio_event_monitor: $(IIO_EVENT_MONITOR_IN)
  	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
0c4b65002   Peter Robinson   tools: iio: Add a...
46

18956cf2d   Andy Shevchenko   iio: tools: move ...
47
  IIO_GENERIC_BUFFER_IN := $(OUTPUT)iio_generic_buffer-in.o
731b60afc   Laura Abbott   tools: iio: Corre...
48
  $(IIO_GENERIC_BUFFER_IN): prepare FORCE $(OUTPUT)iio_utils-in.o
18956cf2d   Andy Shevchenko   iio: tools: move ...
49
50
51
  	$(Q)$(MAKE) $(build)=iio_generic_buffer
  $(OUTPUT)iio_generic_buffer: $(IIO_GENERIC_BUFFER_IN)
  	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
0c4b65002   Peter Robinson   tools: iio: Add a...
52

817020cfb   Roberta Dobrescu   iio: Move iio use...
53
  clean:
18956cf2d   Andy Shevchenko   iio: tools: move ...
54
55
56
  	rm -f $(ALL_PROGRAMS)
  	rm -rf $(OUTPUT)include/linux/iio
  	find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
25e3f85aa   Andy Shevchenko   iio: tools: add i...
57
58
59
60
61
  install: $(ALL_PROGRAMS)
  	install -d -m 755 $(DESTDIR)$(bindir);		\
  	for program in $(ALL_PROGRAMS); do		\
  		install $$program $(DESTDIR)$(bindir);	\
  	done
18956cf2d   Andy Shevchenko   iio: tools: move ...
62
  FORCE:
25e3f85aa   Andy Shevchenko   iio: tools: add i...
63
  .PHONY: all install clean FORCE prepare