2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-04 20:37:50 +00:00
qpdf/make/msvc.mk

98 lines
2.7 KiB
Makefile
Raw Normal View History

# --- Required interface definitions ---
OBJ=obj
LOBJ=obj
# Usage: $(call libname,base)
define libname
$(1).lib
endef
# Usage: $(call binname,base)
define binname
$(1).exe
endef
# --- Local Changes ---
# Filter out -g
CFLAGS := $(filter-out -g,$(CFLAGS))
CXXFLAGS := $(filter-out -g,$(CXXFLAGS))
clean::
$(RM) *.pdb
# --- Required rule definitions ---
2019-01-14 02:29:12 +00:00
# 1 2 3
# Usage: $(call compile,src,includes,xflags)
define compile
2019-01-14 02:29:12 +00:00
cl -nologo -O2 -Zi -Gy -EHsc -MD -TP -GR $(CPPFLAGS) $(CXXFLAGS) $(3) \
$(foreach I,$(2),-I$(I)) \
2016-01-24 20:51:21 +00:00
-c $(1) -Fo$(call src_to_obj,$(1))
endef
# 1 2 3
# Usage: $(call c_compile,src,includes,xflags)
define c_compile
cl -nologo -O2 -Zi -Gy -EHsc -MD $(CPPFLAGS) $(CFLAGS) $(3) \
$(foreach I,$(2),-I$(I)) \
2016-01-24 20:51:21 +00:00
-c $(1) -Fo$(call c_src_to_obj,$(1))
endef
# 1 2
# Usage: $(call libcompile,src,includes)
define libcompile
2016-01-24 20:51:21 +00:00
cl -nologo -O2 -Zi -Gy -EHsc -MD -TP -GR $(CPPFLAGS) $(CXXFLAGS) \
-DDLL_EXPORT $(foreach I,$(2),-I$(I)) \
2016-01-24 20:51:21 +00:00
-c $(1) -Fo$(call src_to_obj,$(1))
endef
# 1 2
# Usage: $(call c_libcompile,src,includes)
define c_libcompile
2016-01-24 20:51:21 +00:00
cl -nologo -O2 -Zi -Gy -EHsc -MD $(CPPFLAGS) $(CXXFLAGS) \
-DDLL_EXPORT $(foreach I,$(2),-I$(I)) \
2016-01-24 20:51:21 +00:00
-c $(1) -Fo$(call c_src_to_obj,$(1))
endef
# 1 2
# Usage: $(call makeslib,objs,library)
define makeslib
2016-01-24 20:51:21 +00:00
lib -nologo -OUT:$(2) $(1)
endef
# 1 2 3 4 5 6 7
# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age)
define makelib
2016-01-24 20:51:21 +00:00
cl -nologo -O2 -Zi -Gy -EHsc -MD -LD -Fe$(basename $(2))$(shell expr $(5) - $(7)).dll $(1) \
-link -SUBSYSTEM:CONSOLE -incremental:no \
2016-01-24 20:51:21 +00:00
$(foreach L,$(subst -L,,$(3)),-LIBPATH:$(L)) \
$(foreach L,$(subst -l,,$(4)),$(L).lib)
if [ -f $(basename $(2))$(shell expr $(5) - $(7)).dll.manifest ]; then \
mt.exe -nologo -manifest $(basename $(2))$(shell expr $(5) - $(7)).dll.manifest \
-outputresource:$(basename $(2))$(shell expr $(5) - $(7)).dll\;2; \
fi
mv $(basename $(2))$(shell expr $(5) - $(7)).lib $(2)
endef
# 1 2 3 4 5
# Usage: $(call makebin,objs,binary,ldflags,libs,xlinkflags)
define makebin
2016-01-24 20:51:21 +00:00
cl -nologo -O2 -Zi -Gy -EHsc -MD $(1) \
$(if $(5),$(5),$(WINDOWS_MAIN_XLINK_FLAGS)) \
-link -SUBSYSTEM:CONSOLE -incremental:no -OUT:$(2) \
2016-01-24 20:51:21 +00:00
$(foreach L,$(subst -L,,$(3)),-LIBPATH:$(L)) \
$(foreach L,$(subst -l,,$(4)),$(L).lib)
if [ -f $(2).manifest ]; then \
mt.exe -nologo -manifest $(2).manifest \
-outputresource:$(2)\;2; \
fi
endef
# Install target
INSTALL_DIR = install-msvc$(WINDOWS_WORDSIZE)
include make/installwin.mk
install: installwin