1 # SPDX-License-Identifier: GPL-2.0 << 2 # Makefile for USB tools 1 # Makefile for USB tools 3 include ../scripts/Makefile.include << 4 2 5 bindir ?= /usr/bin !! 3 CC = $(CROSS_COMPILE)gcc 6 !! 4 PTHREAD_LIBS = -lpthread 7 ifeq ($(srctree),) !! 5 WARNINGS = -Wall -Wextra 8 srctree := $(patsubst %/,%,$(dir $(CURDIR))) !! 6 CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) -I../include 9 srctree := $(patsubst %/,%,$(dir $(srctree))) !! 7 10 endif !! 8 all: testusb ffs-test 11 !! 9 %: %.c 12 # Do not use make's built-in rules !! 10 $(CC) $(CFLAGS) -o $@ $^ 13 # (this improves performance and avoids hard-t << 14 MAKEFLAGS += -r << 15 << 16 override CFLAGS += -O2 -Wall -Wextra -g -D_GNU << 17 override LDFLAGS += -lpthread << 18 << 19 ALL_TARGETS := testusb ffs-test << 20 ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_ << 21 << 22 all: $(ALL_PROGRAMS) << 23 << 24 export srctree OUTPUT CC LD CFLAGS << 25 include $(srctree)/tools/build/Makefile.includ << 26 << 27 TESTUSB_IN := $(OUTPUT)testusb-in.o << 28 $(TESTUSB_IN): FORCE << 29 $(Q)$(MAKE) $(build)=testusb << 30 $(OUTPUT)testusb: $(TESTUSB_IN) << 31 $(QUIET_LINK)$(CC) $(CFLAGS) $< -o $@ << 32 << 33 FFS_TEST_IN := $(OUTPUT)ffs-test-in.o << 34 $(FFS_TEST_IN): FORCE << 35 $(Q)$(MAKE) $(build)=ffs-test << 36 $(OUTPUT)ffs-test: $(FFS_TEST_IN) << 37 $(QUIET_LINK)$(CC) $(CFLAGS) $< -o $@ << 38 11 39 clean: 12 clean: 40 rm -f $(ALL_PROGRAMS) !! 13 $(RM) testusb ffs-test 41 find $(or $(OUTPUT),.) -name '*.o' -de << 42 << 43 install: $(ALL_PROGRAMS) << 44 install -d -m 755 $(DESTDIR)$(bindir); << 45 for program in $(ALL_PROGRAMS); do << 46 install $$program $(DESTDIR)$( << 47 done << 48 << 49 FORCE: << 50 << 51 .PHONY: all install clean FORCE prepare <<
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.