2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-16 17:45:09 +00:00
qpdf/make/msvc.mk
Jay Berkenbilt 5d4cad9c02 ABI change: fix use of off_t, size_t, and integer types
Significantly improve the code's use of off_t for file offsets, size_t
for memory sizes, and integer types in cases where there has to be
compatibility with external interfaces.  Rework sections of the code
that would have prevented qpdf from working on files larger than 2 (or
maybe 4) GB in size.
2012-06-20 15:20:26 -04:00

108 lines
2.8 KiB
Makefile

# --- 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))
# /WX makes all warnings errors.
CFLAGS += /WX
CXXFLAGS += /WX
# /w14267 makes warning 4267 a level 1 warning. This warning reports
# potential issues between size_t, off_t, and non-compatible integer
# types.
CFLAGS += /w14267
CXXFLAGS += /w14267
clean::
$(RM) *.pdb
# --- Required rule definitions ---
# 1 2
# Usage: $(call compile,src,includes)
define compile
cl /nologo /Zi /Gy /EHsc /MD /TP /GR $(CPPFLAGS) $(CXXFLAGS) \
$(foreach I,$(2),-I$(I)) \
/c $(1) /Fo$(call src_to_obj,$(1))
endef
# 1 2
# Usage: $(call c_compile,src,includes)
define c_compile
cl /nologo /O2 /Zi /Gy /EHsc /MD $(CPPFLAGS) $(CFLAGS) \
$(foreach I,$(2),-I$(I)) \
/c $(1) /Fo$(call c_src_to_obj,$(1))
endef
# 1 2
# Usage: $(call libcompile,src,includes)
define libcompile
cl /nologo /O2 /Zi /Gy /EHsc /MD /TP /GR $(CPPFLAGS) $(CXXFLAGS) \
-DDLL_EXPORT $(foreach I,$(2),-I$(I)) \
/c $(1) /Fo$(call src_to_obj,$(1))
endef
# 1 2
# Usage: $(call c_libcompile,src,includes)
define c_libcompile
cl /nologo /O2 /Zi /Gy /EHsc /MD $(CPPFLAGS) $(CXXFLAGS) \
-DDLL_EXPORT $(foreach I,$(2),-I$(I)) \
/c $(1) /Fo$(call c_src_to_obj,$(1))
endef
# 1 2
# Usage: $(call makeslib,objs,library)
define makeslib
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
cl /nologo /O2 /Zi /Gy /EHsc /MD /LD /Fe$(basename $(2))$(shell expr $(5) - $(7)).dll $(1) \
/link /incremental:no \
$(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
# Usage: $(call makebin,objs,binary,ldflags,libs)
define makebin
cl /nologo /O2 /Zi /Gy /EHsc /MD $(1) \
/link /incremental:no /OUT:$(2) \
$(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
STATIC_LIB_NAME = qpdf.lib
include make/installwin.mk
install: installwin