You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.2 KiB

  1. # Create delay-loaded libraries from a DLL, that aren't vulnerable to side-loading
  2. AM_V_DLLTOOL_0 = @echo " LIB $@";$(DLLTOOL)
  3. AM_V_DLLTOOL_1 = $(DLLTOOL)
  4. AM_V_DLLTOOL_ = $(AM_V_DLLTOOL_$(AM_DEFAULT_VERBOSITY))
  5. AM_V_DLLTOOL = $(AM_V_DLLTOOL_$(V))
  6. AM_V_SED_0 = @echo " SED $<";$(SED)
  7. AM_V_SED_1 = $(SED)
  8. AM_V_SED_ = $(AM_V_SED_$(AM_DEFAULT_VERBOSITY))
  9. AM_V_SED = $(AM_V_SED_$(V))
  10. # Ah the joys of Windows DLL calling conventions, that require an @## suffix in the .def
  11. # for x86_32 and but no @## for x86_64, thereby forcing us to strip stuff according to the
  12. # target arch. Oh, and we can't use 'target_cpu' or AC definitions on account that we are
  13. # switching archs when building on our local machine, and don't want to have to go though
  14. # a costly reconf each time when we can simply issue a 'make clean'.
  15. TUPLE := $(shell $(CC) -dumpmachine)
  16. TARGET := $(word 1,$(subst -, ,$(TUPLE)))
  17. DEF_SUFFIX := $(if $(TARGET:x86_64=),.def,.def64)
  18. .PHONY: all
  19. all: dwmapi-delaylib.lib version-delaylib.lib wintrust-delaylib.lib
  20. %.def64: %.def
  21. $(AM_V_SED) "s/@.*//" $< >$@
  22. %-delaylib.lib: %$(DEF_SUFFIX)
  23. $(AM_V_DLLTOOL) --input-def $< --output-delaylib $@ --dllname $(basename $<).dll
  24. clean:
  25. $(RM) -rf *.lib