summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/gpio/Makefile
blob: f22b22aef7bfba04b4ef6ab703b32b4afeb17f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# SPDX-License-Identifier: GPL-2.0

MOUNT_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
MOUNT_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
ifeq ($(MOUNT_LDLIBS),)
MOUNT_LDLIBS := -lmount -I/usr/include/libmount
endif

CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(MOUNT_CFLAGS)
LDLIBS += $(MOUNT_LDLIBS)

TEST_PROGS := gpio-mockup.sh
TEST_FILES := gpio-mockup-sysfs.sh
TEST_PROGS_EXTENDED := gpio-mockup-chardev

GPIODIR := $(realpath ../../../gpio)
GPIOOBJ := gpio-utils.o

include ../lib.mk

all: $(TEST_PROGS_EXTENDED)

override define CLEAN
	$(RM) $(TEST_PROGS_EXTENDED)
	$(MAKE) -C $(GPIODIR) OUTPUT=$(GPIODIR)/ clean
endef

$(TEST_PROGS_EXTENDED):| khdr
$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)

$(GPIODIR)/$(GPIOOBJ):
	$(MAKE) OUTPUT=$(GPIODIR)/ -C $(GPIODIR)