automake: Add extra Makefile to handle unknown automake targets
authorChris Dickens <christopher.a.dickens@gmail.com>
Thu, 2 Apr 2020 03:54:09 +0000 (20:54 -0700)
committerChris Dickens <christopher.a.dickens@gmail.com>
Thu, 2 Apr 2020 03:54:09 +0000 (20:54 -0700)
Automake does not know how to compile Windows Resource files, so we have
manually told automake how to do this. One particular short-coming is
that dependencies are not automatically generated and tracked as they
are with other known automake targets. Address this by creating an extra
makefile that contains the automake rules needed for building source for
Windows targets. This also includes outputting more accurate tags during
compilation instead of using the generic "GEN" tag.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/Makefile.am
libusb/Makefile.am.extra [new file with mode: 0644]
libusb/strerror.c [changed mode: 0755->0644]
libusb/version_nano.h

index 8b89ee6..9432c62 100644 (file)
@@ -75,16 +75,16 @@ endif
 if OS_WINDOWS
 OS_SRC = $(OS_WINDOWS_SRC)
 
-.rc.lo:
-       $(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
+include Makefile.am.extra
 
-libusb-1.0.lo: libusb-1.0.rc version.h version_nano.h
+# Dependencies for compiling libusb-1.0.lo from libusb-1.0.rc
+-include ./$(DEPDIR)/libusb-1.0.Plo
 
 if CREATE_IMPORT_LIB
 all-local: .libs/libusb-1.0.dll.a
 # Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
 .libs/libusb-1.0.dll.a: libusb-1.0.def libusb-1.0.la
-       $(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $< --dllname libusb-1.0.dll --output-lib $@
+       $(AM_V_DLLTOOL)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $< --dllname libusb-1.0.dll --output-lib $@
 endif
 endif
 
diff --git a/libusb/Makefile.am.extra b/libusb/Makefile.am.extra
new file mode 100644 (file)
index 0000000..a5c1490
--- /dev/null
@@ -0,0 +1,26 @@
+AM_V_DLLTOOL = $(am__v_DLLTOOL_$(V))
+am__v_DLLTOOL_ = $(am__v_DLLTOOL_$(AM_DEFAULT_VERBOSITY))
+am__v_DLLTOOL_0 = @echo "  DLLTOOL " $@;
+am__v_DLLTOOL_1 = 
+
+AM_V_RC = $(am__v_RC_$(V))
+am__v_RC_ = $(am__v_RC_$(AM_DEFAULT_VERBOSITY))
+am__v_RC_0 = @echo "  RC      " $@;
+am__v_RC_1 = 
+
+LTRC = $(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(RC) $(AM_RCFLAGS) \
+       $(RCFLAGS)
+
+RCPPARGS = \
+       --preprocessor-arg -MT \
+       --preprocessor-arg $@ \
+       --preprocessor-arg -MD \
+       --preprocessor-arg -MP \
+       --preprocessor-arg -MF \
+       --preprocessor-arg $$depbase.Tpo
+
+.rc.lo:
+       $(AM_V_RC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+       $(LTRC) $(RCPPARGS) -i $< -o $@ &&\
+       $(am__mv) $$depbase.Tpo $$depbase.Plo
old mode 100755 (executable)
new mode 100644 (file)
index 36ce541..6281b80 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11485
+#define LIBUSB_NANO 11486