162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ciinclude ../scripts/Makefile.include 362306a36Sopenharmony_ci 462306a36Sopenharmony_cibindir ?= /usr/bin 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciifeq ($(srctree),) 762306a36Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(CURDIR))) 862306a36Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree))) 962306a36Sopenharmony_ciendif 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci# Do not use make's built-in rules 1262306a36Sopenharmony_ci# (this improves performance and avoids hard-to-debug behaviour); 1362306a36Sopenharmony_ciMAKEFLAGS += -r 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_cioverride CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ciALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer 1862306a36Sopenharmony_ciALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciall: $(ALL_PROGRAMS) 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciexport srctree OUTPUT CC LD CFLAGS 2362306a36Sopenharmony_ciinclude $(srctree)/tools/build/Makefile.include 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci# 2662306a36Sopenharmony_ci# We need the following to be outside of kernel tree 2762306a36Sopenharmony_ci# 2862306a36Sopenharmony_ci$(OUTPUT)include/linux/iio: ../../include/uapi/linux/iio 2962306a36Sopenharmony_ci mkdir -p $(OUTPUT)include/linux/iio 2>&1 || true 3062306a36Sopenharmony_ci ln -sf $(CURDIR)/../../include/uapi/linux/iio/buffer.h $@ 3162306a36Sopenharmony_ci ln -sf $(CURDIR)/../../include/uapi/linux/iio/events.h $@ 3262306a36Sopenharmony_ci ln -sf $(CURDIR)/../../include/uapi/linux/iio/types.h $@ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ciprepare: $(OUTPUT)include/linux/iio 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciIIO_UTILS_IN := $(OUTPUT)iio_utils-in.o 3762306a36Sopenharmony_ci$(IIO_UTILS_IN): prepare FORCE 3862306a36Sopenharmony_ci $(Q)$(MAKE) $(build)=iio_utils 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ciLSIIO_IN := $(OUTPUT)lsiio-in.o 4162306a36Sopenharmony_ci$(LSIIO_IN): prepare FORCE $(OUTPUT)iio_utils-in.o 4262306a36Sopenharmony_ci $(Q)$(MAKE) $(build)=lsiio 4362306a36Sopenharmony_ci$(OUTPUT)lsiio: $(LSIIO_IN) 4462306a36Sopenharmony_ci $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ciIIO_EVENT_MONITOR_IN := $(OUTPUT)iio_event_monitor-in.o 4762306a36Sopenharmony_ci$(IIO_EVENT_MONITOR_IN): prepare FORCE $(OUTPUT)iio_utils-in.o 4862306a36Sopenharmony_ci $(Q)$(MAKE) $(build)=iio_event_monitor 4962306a36Sopenharmony_ci$(OUTPUT)iio_event_monitor: $(IIO_EVENT_MONITOR_IN) 5062306a36Sopenharmony_ci $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ciIIO_GENERIC_BUFFER_IN := $(OUTPUT)iio_generic_buffer-in.o 5362306a36Sopenharmony_ci$(IIO_GENERIC_BUFFER_IN): prepare FORCE $(OUTPUT)iio_utils-in.o 5462306a36Sopenharmony_ci $(Q)$(MAKE) $(build)=iio_generic_buffer 5562306a36Sopenharmony_ci$(OUTPUT)iio_generic_buffer: $(IIO_GENERIC_BUFFER_IN) 5662306a36Sopenharmony_ci $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ciclean: 5962306a36Sopenharmony_ci rm -f $(ALL_PROGRAMS) 6062306a36Sopenharmony_ci rm -rf $(OUTPUT)include/linux/iio 6162306a36Sopenharmony_ci find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ciinstall: $(ALL_PROGRAMS) 6462306a36Sopenharmony_ci install -d -m 755 $(DESTDIR)$(bindir); \ 6562306a36Sopenharmony_ci for program in $(ALL_PROGRAMS); do \ 6662306a36Sopenharmony_ci install $$program $(DESTDIR)$(bindir); \ 6762306a36Sopenharmony_ci done 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ciFORCE: 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci.PHONY: all install clean FORCE prepare 72