From d54ddec236bf9bdb8c032cd5fbdb0aa46ffebe86 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 27 Sep 2024 19:00:18 -0600 Subject: use GNU Make for `generate` --- libusb/CMakeLists.txt | 15 +-------------- libusb/include/libusb/tusb_helpers.h | 14 ++++++++------ libusb/include/libusb/tusb_helpers.h.gen | 7 ++++--- 3 files changed, 13 insertions(+), 23 deletions(-) (limited to 'libusb') diff --git a/libusb/CMakeLists.txt b/libusb/CMakeLists.txt index 6c25703..e1a9284 100644 --- a/libusb/CMakeLists.txt +++ b/libusb/CMakeLists.txt @@ -4,20 +4,7 @@ # SPDX-Licence-Identifier: AGPL-3.0-or-later add_library(libusb INTERFACE) +target_include_directories(libusb SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) target_sources(libusb INTERFACE usb_common.c ) -target_include_directories(libusb SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) - -add_custom_command( - OUTPUT ${CMAKE_SOURCE_DIR}/3rd-party/MS-LCID.pdf - ${CMAKE_SOURCE_DIR}/3rd-party/MS-LCID.txt - ${CMAKE_CURRENT_SOURCE_DIR}/include/libusb/tusb_helpers.h - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/include/libusb/tusb_helpers.gen - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/include/libusb/tusb_helpers.gen -) -# add_dependencies(generate -# ${CMAKE_SOURCE_DIR}/3rd-party/MS-LCID.pdf -# ${CMAKE_SOURCE_DIR}/3rd-party/MS-LCID.txt -# ${CMAKE_CURRENT_SOURCE_DIR}/include/libusb/tusb_helpers.h -# ) diff --git a/libusb/include/libusb/tusb_helpers.h b/libusb/include/libusb/tusb_helpers.h index cd96357..2a6ee3c 100644 --- a/libusb/include/libusb/tusb_helpers.h +++ b/libusb/include/libusb/tusb_helpers.h @@ -1,4 +1,5 @@ -/* tusb_helpers.h - Preprocessor macros that I think should be included in TinyUSB +/* Generated by `./libusb/include/libusb/tusb_helpers.h.gen `. DO NOT EDIT! */ +/* libusb/tusb_helpers.h - Preprocessor macros that I think should be included in TinyUSB * * Copyright (c) 2024 Luke T. Shumaker * @@ -24,10 +25,11 @@ * */ -#ifndef _USB_HELPERS_H_ -#define _USB_HELPERS_H_ +#ifndef _LIBUSB_TUSB_HELPERS_H_ +#define _LIBUSB_TUSB_HELPERS_H_ -/* USB 2.0 §9.6.7 "String" says "The list of currently defined USB LANGIDs can be found at +/** + * USB 2.0 §9.6.7 "String" says "The list of currently defined USB LANGIDs can be found at * http://www.usb.org/developers/docs.html.", but that page 404s. * * Once upon a time the USB-IF (usb.org) published a "Language Identifiers (LANGIDs)" version 1.0, @@ -962,10 +964,10 @@ #define LANGID_QPS_PLOCM 0x09FF #define LANGID_QPS_PLOCM 0x09FF -/* USB 2.0 §9.6.6 "Endpoint", field bEndpointAddress, bit 7 */ +/** USB 2.0 §9.6.6 "Endpoint", field bEndpointAddress, bit 7 */ #define TUD_ENDPOINT_OUT 0x00 #define TUD_ENDPOINT_IN 0x80 #define TU_UTF16(str) u ## str -#endif /* _USB_HELPERS_H_ */ +#endif /* _LIBUSB_TUSB_HELPERS_H_ */ diff --git a/libusb/include/libusb/tusb_helpers.h.gen b/libusb/include/libusb/tusb_helpers.h.gen index 213eda0..9b917da 100755 --- a/libusb/include/libusb/tusb_helpers.h.gen +++ b/libusb/include/libusb/tusb_helpers.h.gen @@ -2,6 +2,7 @@ # -*- Mode: C -*- set -e exec >"${0%.gen}" +echo "/* Generated by \`$0 $*\`. DO NOT EDIT! */" cat <<'EOT' /* libusb/tusb_helpers.h - Preprocessor macros that I think should be included in TinyUSB * @@ -62,9 +63,9 @@ cat <<'EOT' * to sort their list of by most-significant-byte was a poor editorial choice. */ EOT -[ -f ${CMAKE_SOURCE_DIR?}/3rd-party/MS-LCID.pdf ] || wget -O ${CMAKE_SOURCE_DIR?}/3rd-party/MS-LCID.pdf 'https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-LCID/%5bMS-LCID%5d.pdf' -[ -f ${CMAKE_SOURCE_DIR?}/3rd-party/MS-LCID.txt ] || pdftotext -layout ${CMAKE_SOURCE_DIR?}/3rd-party/MS-LCID.pdf -<${CMAKE_SOURCE_DIR?}/3rd-party/MS-LCID.txt \ +[ -f 3rd-party/MS-LCID.pdf ] || wget -O 3rd-party/MS-LCID.pdf 'https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-LCID/%5bMS-LCID%5d.pdf' +[ -f 3rd-party/MS-LCID.txt ] || pdftotext -layout 3rd-party/MS-LCID.pdf +<3rd-party/MS-LCID.txt \ grep -E '^\s*0x[0-9A-F]{4}\s+[a-z]' | sed 's/,.*//' | grep -v reserved | # find the lines we're interested in sed -E 's/^\s*0x(..)(..)\s+(\S.*)/\2 \1 \3/p' | tr '[:lower:]-' '[:upper:]_' | # format them as 'PRIhex SUBhex UPPER_STR' sort | -- cgit v1.2.3-2-g168b