1 # SPDX-License-Identifier: GPL-2.0
2 # Makefile for USB tools
3 include ..
/scripts
/Makefile.
include
8 srctree
:= $(patsubst %/,%,$(dir $(CURDIR
)))
9 srctree
:= $(patsubst %/,%,$(dir $(srctree
)))
12 # Do not use make's built-in rules
13 # (this improves performance and avoids hard-to-debug behaviour);
16 override CFLAGS
+= -O2
-Wall
-Wextra
-g
-D_GNU_SOURCE
-I
$(OUTPUT
)include -I
$(srctree
)/tools
/include
17 override LDFLAGS
+= -lpthread
19 ALL_TARGETS
:= testusb ffs-test
20 ALL_PROGRAMS
:= $(patsubst %,$(OUTPUT
)%,$(ALL_TARGETS
))
24 export srctree OUTPUT CC LD CFLAGS
25 include $(srctree
)/tools
/build
/Makefile.
include
27 TESTUSB_IN
:= $(OUTPUT
)testusb-in.o
29 $(Q
)$(MAKE
) $(build
)=testusb
30 $(OUTPUT
)testusb
: $(TESTUSB_IN
)
31 $(QUIET_LINK
)$(CC
) $(CFLAGS
) $< -o
$@
$(LDFLAGS
)
33 FFS_TEST_IN
:= $(OUTPUT
)ffs-test-in.o
35 $(Q
)$(MAKE
) $(build
)=ffs-test
36 $(OUTPUT
)ffs-test
: $(FFS_TEST_IN
)
37 $(QUIET_LINK
)$(CC
) $(CFLAGS
) $< -o
$@
$(LDFLAGS
)
41 find
$(if
$(OUTPUT
),$(OUTPUT
),.
) -name
'*.o' -delete
-o
-name
'\.*.d' -delete
-o
-name
'\.*.o.cmd' -delete
43 install: $(ALL_PROGRAMS
)
44 install -d
-m
755 $(DESTDIR
)$(bindir); \
45 for program in
$(ALL_PROGRAMS
); do \
46 install $$program $(DESTDIR
)$(bindir); \
51 .PHONY
: all install clean FORCE prepare