From ecb31e7903fa8c24ea99f2d4ee07975b5a3b90ac Mon Sep 17 00:00:00 2001 From: dianshi Date: Fri, 11 Mar 2022 17:02:59 +0000 Subject: Update choice of targets --- Makefile | 3 +- include/linux/config.h | 157 +++++++++++++++++++++++++++++++++++++++++++++++++ include/macos/config.h | 37 ++++++++++++ src/config.h | 157 ------------------------------------------------- src/make.mk | 20 +++++-- 5 files changed, 211 insertions(+), 163 deletions(-) create mode 100644 include/linux/config.h create mode 100644 include/macos/config.h delete mode 100644 src/config.h diff --git a/Makefile b/Makefile index fa7e3d7..34b96b4 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ OBJ_OS= BUILD_DIR=build/ -include src/make.mk +OS=linux +include src/make.mk SOURCES+=$(wildcard src/*.c) SOURCES+=$(wildcard src/os/*.c) diff --git a/include/linux/config.h b/include/linux/config.h new file mode 100644 index 0000000..97a82c2 --- /dev/null +++ b/include/linux/config.h @@ -0,0 +1,157 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to the attribute for default visibility. */ +#define DEFAULT_VISIBILITY __attribute__ ((visibility ("default"))) + +/* Define to 1 to start with debug message logging enabled. */ +/* #undef ENABLE_DEBUG_LOGGING */ + +/* Define to 1 to enable message logging. */ +#define ENABLE_LOGGING 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ASM_TYPES_H */ + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the declaration of `EFD_CLOEXEC', and to 0 if you + don't. */ +#define HAVE_DECL_EFD_CLOEXEC 1 + +/* Define to 1 if you have the declaration of `EFD_NONBLOCK', and to 0 if you + don't. */ +#define HAVE_DECL_EFD_NONBLOCK 1 + +/* Define to 1 if you have the declaration of `TFD_CLOEXEC', and to 0 if you + don't. */ +#define HAVE_DECL_TFD_CLOEXEC 1 + +/* Define to 1 if you have the declaration of `TFD_NONBLOCK', and to 0 if you + don't. */ +#define HAVE_DECL_TFD_NONBLOCK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if the system has eventfd functionality. */ +#define HAVE_EVENTFD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header + file. */ +/* #undef HAVE_IOKIT_USB_IOUSBHOSTFAMILYDEFINITIONS_H */ + +/* Define to 1 if you have the `udev' library (-ludev). */ +#define HAVE_LIBUDEV 1 + +/* Define to 1 if the system has the type `nfds_t'. */ +#define HAVE_NFDS_T 1 + +/* Define to 1 if you have the `pipe2' function. */ +#define HAVE_PIPE2 1 + +/* Define to 1 if you have the `pthread_condattr_setclock' function. */ +#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1 + +/* Define to 1 if you have the `pthread_setname_np' function. */ +#define HAVE_PTHREAD_SETNAME_NP 1 + +/* Define to 1 if you have the `pthread_threadid_np' function. */ +/* #undef HAVE_PTHREAD_THREADID_NP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if the system has the type `struct timespec'. */ +/* #undef HAVE_STRUCT_TIMESPEC */ + +/* Define to 1 if you have the `syslog' function. */ +/* #undef HAVE_SYSLOG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if the system has timerfd functionality. */ +#define HAVE_TIMERFD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "libusb-1.0" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "libusb-devel@lists.sourceforge.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libusb-1.0" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libusb-1.0 1.0.25" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libusb-1.0" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "http://libusb.info" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.0.25" + +/* Define to 1 if compiling for a POSIX platform. */ +#define PLATFORM_POSIX 1 + +/* Define to 1 if compiling for a Windows platform. */ +/* #undef PLATFORM_WINDOWS */ + +/* Define to the attribute for enabling parameter checks on printf-like + functions. */ +#define PRINTF_FORMAT(a, b) __attribute__ ((__format__ (__printf__, a, b))) + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#define STDC_HEADERS 1 + +/* Define to 1 to output logging messages to the systemwide log. */ +/* #undef USE_SYSTEM_LOGGING_FACILITY */ + +/* Version number of package */ +#define VERSION "1.0.25" + +/* Enable GNU extensions. */ +#define _GNU_SOURCE 1 + +/* Define to the oldest supported Windows version. */ +/* #undef _WIN32_WINNT */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif diff --git a/include/macos/config.h b/include/macos/config.h new file mode 100644 index 0000000..59f3463 --- /dev/null +++ b/include/macos/config.h @@ -0,0 +1,37 @@ +/* config.h. Manually generated for Xcode. */ + +#include + +/* Define to the attribute for default visibility. */ +#define DEFAULT_VISIBILITY __attribute__ ((visibility ("default"))) + +/* Define to 1 to enable message logging. */ +#define ENABLE_LOGGING 1 + +/* On 10.12 and later, use newly available clock_*() functions */ +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 +#endif + +/* On 10.6 and later, use newly available pthread_threadid_np() function */ +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 +/* Define to 1 if you have the 'pthread_threadid_np' function. */ +#define HAVE_PTHREAD_THREADID_NP 1 +#endif + +/* Define to 1 if the system has the type `nfds_t'. */ +#define HAVE_NFDS_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if compiling for a POSIX platform. */ +#define PLATFORM_POSIX 1 + +/* Define to the attribute for enabling parameter checks on printf-like + functions. */ +#define PRINTF_FORMAT(a, b) __attribute__ ((__format__ (__printf__, a, b))) + +/* Enable GNU extensions. */ +#define _GNU_SOURCE 1 diff --git a/src/config.h b/src/config.h deleted file mode 100644 index 97a82c2..0000000 --- a/src/config.h +++ /dev/null @@ -1,157 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to the attribute for default visibility. */ -#define DEFAULT_VISIBILITY __attribute__ ((visibility ("default"))) - -/* Define to 1 to start with debug message logging enabled. */ -/* #undef ENABLE_DEBUG_LOGGING */ - -/* Define to 1 to enable message logging. */ -#define ENABLE_LOGGING 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ASM_TYPES_H */ - -/* Define to 1 if you have the `clock_gettime' function. */ -#define HAVE_CLOCK_GETTIME 1 - -/* Define to 1 if you have the declaration of `EFD_CLOEXEC', and to 0 if you - don't. */ -#define HAVE_DECL_EFD_CLOEXEC 1 - -/* Define to 1 if you have the declaration of `EFD_NONBLOCK', and to 0 if you - don't. */ -#define HAVE_DECL_EFD_NONBLOCK 1 - -/* Define to 1 if you have the declaration of `TFD_CLOEXEC', and to 0 if you - don't. */ -#define HAVE_DECL_TFD_CLOEXEC 1 - -/* Define to 1 if you have the declaration of `TFD_NONBLOCK', and to 0 if you - don't. */ -#define HAVE_DECL_TFD_NONBLOCK 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if the system has eventfd functionality. */ -#define HAVE_EVENTFD 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header - file. */ -/* #undef HAVE_IOKIT_USB_IOUSBHOSTFAMILYDEFINITIONS_H */ - -/* Define to 1 if you have the `udev' library (-ludev). */ -#define HAVE_LIBUDEV 1 - -/* Define to 1 if the system has the type `nfds_t'. */ -#define HAVE_NFDS_T 1 - -/* Define to 1 if you have the `pipe2' function. */ -#define HAVE_PIPE2 1 - -/* Define to 1 if you have the `pthread_condattr_setclock' function. */ -#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1 - -/* Define to 1 if you have the `pthread_setname_np' function. */ -#define HAVE_PTHREAD_SETNAME_NP 1 - -/* Define to 1 if you have the `pthread_threadid_np' function. */ -/* #undef HAVE_PTHREAD_THREADID_NP */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if the system has the type `struct timespec'. */ -/* #undef HAVE_STRUCT_TIMESPEC */ - -/* Define to 1 if you have the `syslog' function. */ -/* #undef HAVE_SYSLOG */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if the system has timerfd functionality. */ -#define HAVE_TIMERFD 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#define LT_OBJDIR ".libs/" - -/* Name of package */ -#define PACKAGE "libusb-1.0" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "libusb-devel@lists.sourceforge.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libusb-1.0" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libusb-1.0 1.0.25" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libusb-1.0" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "http://libusb.info" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.0.25" - -/* Define to 1 if compiling for a POSIX platform. */ -#define PLATFORM_POSIX 1 - -/* Define to 1 if compiling for a Windows platform. */ -/* #undef PLATFORM_WINDOWS */ - -/* Define to the attribute for enabling parameter checks on printf-like - functions. */ -#define PRINTF_FORMAT(a, b) __attribute__ ((__format__ (__printf__, a, b))) - -/* Define to 1 if all of the C90 standard headers exist (not just the ones - required in a freestanding environment). This macro is provided for - backward compatibility; new code need not use it. */ -#define STDC_HEADERS 1 - -/* Define to 1 to output logging messages to the systemwide log. */ -/* #undef USE_SYSTEM_LOGGING_FACILITY */ - -/* Version number of package */ -#define VERSION "1.0.25" - -/* Enable GNU extensions. */ -#define _GNU_SOURCE 1 - -/* Define to the oldest supported Windows version. */ -/* #undef _WIN32_WINNT */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif diff --git a/src/make.mk b/src/make.mk index 85d90e8..8f17b8d 100644 --- a/src/make.mk +++ b/src/make.mk @@ -1,7 +1,7 @@ DIR=src -SRC_UTILS_PRE += $(wildcard $(DIR)/os/*.c) SRC_UTILS += $(wildcard $(DIR)/*.c) +SRC_UTILS_PRE += $(wildcard $(DIR)/os/*.c) SRC_UTILS_PRE_L += $(wildcard $(DIR)/os/linux/*.c) SRC_UTILS_PRE_M = $(wildcard $(DIR)/os/macos/*.c) OBJ_UTILS += $(SRC_UTILS:.c=.o) @@ -10,7 +10,16 @@ OBJ_UTILS_PRE_M += $(SRC_UTILS_PRE_M:.c=.o) OBJ_UTILS_PRE_L += $(SRC_UTILS_PRE_L:.c=.o) LDFLAGS_UTILS = INCLUDE = -I./include -I./src +INCLUDE_L = -I./include/linux +INCLUDE_M = -I./include/macos CFLAGS = -fPIC +OS = linux + + + +build-src: INCLUDE += $(INCLUDE_L) + + build-src: src-pre echo "Hello" @@ -18,7 +27,7 @@ build-src: src-pre echo $(SRC_UTILS) - +build-src-macos: INCLUDE += $(INCLUDE_M) build-src-macos: print src-pre-macos echo "Build macos" @@ -27,10 +36,10 @@ print: echo "$(OBJ_UTILS_PRE_M)" echo "$(OBJ_UTILS)" -$(DIR)-pre-macos: $(OBJ_UTILS_PRE) $(OBJ_UTILS_PRE_M) $(OBJ_UTILS) +$(DIR)-pre-macos: $(OBJ_UTILS) $(OBJ_UTILS_PRE) $(OBJ_UTILS_PRE_M) echo "here 2" -$(DIR)-pre: $(OBJ_UTILS_PRE) $(OBJ_UTILS_PRE_L) $(OBJ_UTILS) +$(DIR)-pre: $(OBJ_UTILS) $(OBJ_UTILS_PRE) $(OBJ_UTILS_PRE_L) echo "here 1" $(DIR)/os/%.o: $(DIR)/os/%.c @@ -39,4 +48,5 @@ $(DIR)/os/%.o: $(DIR)/os/%.c $(DIR)/%.o: $(DIR)/%.c echo "B" - $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $(BUILD_DIR)$@ $(LDFLAGS_UTILS) \ No newline at end of file + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $(BUILD_DIR)$@ $(LDFLAGS_UTILS) + -- cgit v1.2.3