summaryrefslogtreecommitdiffstats
path: root/lib/Makefile.msvc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 07:34:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 07:34:15 +0000
commitafea5f9539cbf1eeaa85ec77d79eb2f59724f470 (patch)
tree2a4eba394a6bc60d2eaa8304d91168a07225d51e /lib/Makefile.msvc
parentInitial commit. (diff)
downloadnghttp2-upstream/1.52.0.tar.xz
nghttp2-upstream/1.52.0.zip
Adding upstream version 1.52.0.upstream/1.52.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--lib/Makefile.msvc254
1 files changed, 254 insertions, 0 deletions
diff --git a/lib/Makefile.msvc b/lib/Makefile.msvc
new file mode 100644
index 0000000..611b39d
--- /dev/null
+++ b/lib/Makefile.msvc
@@ -0,0 +1,254 @@
+#
+# GNU Makefile for nghttp2 / MSVC.
+#
+# By G. Vanem <gvanem@yahoo.no> 2013
+# Updated 3/2015 by Remo Eichenberger @remoe
+# The MIT License apply.
+#
+
+THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
+
+_VERSION := $(shell grep AC_INIT ../configure.ac | cut -d'[' -f3 | sed -e 's/-DEV//g' -e 's/], //g')
+_VERSION := $(subst ., ,$(_VERSION))
+VER_MAJOR := $(word 1,$(_VERSION))
+VER_MINOR := $(word 2,$(_VERSION))
+VER_MICRO := $(word 3,$(_VERSION))
+VERSION := $(VER_MAJOR).$(VER_MINOR).$(VER_MICRO)
+VERSION_NUM := (($(VER_MAJOR) << 16) + ($(VER_MINOR) << 8) + $(VER_MICRO))
+
+GENERATED := 'Generated by $(realpath Makefile.MSVC)'
+
+OBJ_DIR := MSVC_obj
+#SUFFIX :=-vc90-mt-x86
+
+#
+# Where to copy nghttp2.dll + lib + headers to.
+# Note: 'make install' is not in default targets. Do it explicitly.
+#
+TARGET_DIR ?= ../_VC_ROOT
+VC_ROOT := $(abspath $(TARGET_DIR))
+INSTALL_BIN := $(VC_ROOT)/bin
+INSTALL_LIB := $(VC_ROOT)/lib
+INSTALL_HDR := $(VC_ROOT)/include
+DLL_R := $(OBJ_DIR)/nghttp2$(SUFFIX).dll
+DLL_D := $(OBJ_DIR)/nghttp2d$(SUFFIX).dll
+LIB_R := $(OBJ_DIR)/nghttp2-static.lib
+LIB_D := $(OBJ_DIR)/nghttp2d-static.lib
+IMP_R := $(OBJ_DIR)/nghttp2.lib
+IMP_D := $(OBJ_DIR)/nghttp2d.lib
+
+#
+# Build for DEBUG-model and RELEASE at the same time.
+#
+TARGETS := $(LIB_R) $(DLL_R) $(IMP_R) \
+ $(LIB_D) $(DLL_D) $(IMP_D)
+
+EXT_LIBS =
+
+NGHTTP2_PDB_R := $(OBJ_DIR)/nghttp2.pdb
+NGHTTP2_PDB_D := $(OBJ_DIR)/nghttp2d.pdb
+
+CC = cl
+LD := link
+AR := lib
+#CC := icl
+#LD := xilink
+#AR := xilib
+RC := rc
+CFLAGS := -I./includes -Dssize_t=long
+
+CFLAGS_R := -nologo -MD -W3 -Z7 -DBUILDING_NGHTTP2
+CFLAGS_D := -nologo -MDd -W3 -Z7 -DBUILDING_NGHTTP2 \
+ -Ot -D_DEBUG -GF -RTCs -RTCu # -RTCc -GS
+
+LDFLAGS := -nologo -MAP -debug -incremental:no -opt:ref,icf -MANIFEST # -verbose
+
+
+NGHTTP2_SRC := nghttp2_pq.c \
+ nghttp2_map.c \
+ nghttp2_queue.c \
+ nghttp2_frame.c \
+ nghttp2_buf.c \
+ nghttp2_stream.c \
+ nghttp2_outbound_item.c \
+ nghttp2_session.c \
+ nghttp2_submit.c \
+ nghttp2_helper.c \
+ nghttp2_npn.c \
+ nghttp2_hd.c \
+ nghttp2_hd_huffman.c \
+ nghttp2_hd_huffman_data.c \
+ nghttp2_version.c \
+ nghttp2_priority_spec.c \
+ nghttp2_option.c \
+ nghttp2_callbacks.c \
+ nghttp2_mem.c \
+ nghttp2_http.c \
+ nghttp2_rcbuf.c
+
+NGHTTP2_OBJ_R := $(addprefix $(OBJ_DIR)/r_, $(notdir $(NGHTTP2_SRC:.c=.obj)))
+NGHTTP2_OBJ_D := $(addprefix $(OBJ_DIR)/d_, $(notdir $(NGHTTP2_SRC:.c=.obj)))
+
+.PHONY: all intro test_ver install copy_headers_and_libs \
+ install_nghttp2_pyd_0 install_nghttp2_pyd_1 \
+ build_nghttp2_pyd_0 build_nghttp2_pyd_1 \
+ clean_nghttp2_pyd_0 clean_nghttp2_pyd_1
+
+
+all: intro includes/nghttp2/nghttp2ver.h $(OBJ_DIR) $(TARGETS)
+ @echo 'Welcome to NgHTTP2 (release + debug).'
+ @echo 'Do a "make -f Makefile.MSVC install" at own risk!'
+
+intro:
+ @echo 'Building NgHTTP (MSVC) ver. "$(VERSION)".'
+
+test_ver:
+ @echo '$$(VERSION): "$(VERSION)".'
+ @echo '$$(_VERSION): "$(_VERSION)".'
+ @echo '$$(VER_MAJOR): "$(VER_MAJOR)".'
+ @echo '$$(VER_MINOR): "$(VER_MINOR)".'
+ @echo '$$(VER_MICRO): "$(VER_MICRO)".'
+
+$(OBJ_DIR):
+ - mkdir $(OBJ_DIR)
+
+install: includes/nghttp2/nghttp2.h includes/nghttp2/nghttp2ver.h \
+ $(TARGETS) \
+ copy_headers_and_libs
+
+#
+# This MUST be done before using the 'install_nghttp2_pyd_1' rule.
+#
+copy_headers_and_libs:
+ - mkdir -p $(INSTALL_HDR)/nghttp2 $(INSTALL_BIN) $(INSTALL_LIB)
+ cp --update $(addprefix includes/nghttp2/, nghttp2.h nghttp2ver.h) $(INSTALL_HDR)/nghttp2
+ cp --update $(DLL_R) $(DLL_D) $(NGHTTP2_PDB_R) $(NGHTTP2_PDB_D) $(INSTALL_BIN)
+ cp --update $(IMP_R) $(IMP_D) $(LIB_R) $(LIB_D) $(INSTALL_LIB)
+ @echo
+
+$(LIB_R): $(NGHTTP2_OBJ_R)
+ $(AR) -nologo -out:$@ $^
+ @echo
+
+$(LIB_D): $(NGHTTP2_OBJ_D)
+ $(AR) -nologo -out:$@ $^
+ @echo
+
+
+$(IMP_R): $(DLL_R)
+
+$(DLL_R): $(NGHTTP2_OBJ_R) $(OBJ_DIR)/r_nghttp2.res
+ $(LD) $(LDFLAGS) -dll -out:$@ -implib:$(IMP_R) $(NGHTTP2_OBJ_R) -PDB:$(NGHTTP2_PDB_R) $(OBJ_DIR)/r_nghttp2.res $(EXT_LIBS)
+ mt -nologo -manifest $@.manifest -outputresource:$@\;2
+ @echo
+
+$(IMP_D): $(DLL_D)
+
+$(DLL_D): $(NGHTTP2_OBJ_D) $(OBJ_DIR)/d_nghttp2.res
+ $(LD) $(LDFLAGS) -dll -out:$@ -implib:$(IMP_D) $(NGHTTP2_OBJ_D) -PDB:$(NGHTTP2_PDB_D) $(OBJ_DIR)/d_nghttp2.res $(EXT_LIBS)
+ mt -nologo -manifest $@.manifest -outputresource:$@\;2
+ @echo
+
+
+WIN_OBJDIR:=$(shell cygpath -w $(abspath $(OBJ_DIR)))
+WIN_OBJDIR:=$(subst \,/,$(WIN_OBJDIR))
+
+$(OBJ_DIR)/r_%.obj: %.c $(THIS_MAKEFILE)
+ $(CC) $(CFLAGS_R) $(CFLAGS) -Fo$@ -c $<
+ @echo
+
+$(OBJ_DIR)/d_%.obj: %.c $(THIS_MAKEFILE)
+ $(CC) $(CFLAGS_D) $(CFLAGS) -Fo$@ -c $<
+ @echo
+
+$(OBJ_DIR)/r_nghttp2.res: $(OBJ_DIR)/nghttp2.rc $(THIS_MAKEFILE)
+ $(RC) -D_RELEASE -Fo $@ $<
+ @echo
+
+$(OBJ_DIR)/d_nghttp2.res: $(OBJ_DIR)/nghttp2.rc $(THIS_MAKEFILE)
+ $(RC) -D_DEBUG -Fo $@ $<
+ @echo
+
+includes/nghttp2/nghttp2ver.h: includes/nghttp2/nghttp2ver.h.in $(THIS_MAKEFILE)
+ sed < includes/nghttp2/nghttp2ver.h.in \
+ -e 's/@PACKAGE_VERSION@/$(VERSION)/g' \
+ -e 's/@PACKAGE_VERSION_NUM@/$(VERSION_NUM)/g' > $@
+ touch --reference=includes/nghttp2/nghttp2ver.h.in $@
+
+
+define RES_FILE
+ #include <winver.h>
+
+ VS_VERSION_INFO VERSIONINFO
+ FILEVERSION $(VER_MAJOR), $(VER_MINOR), $(VER_MICRO), 0
+ PRODUCTVERSION $(VER_MAJOR), $(VER_MINOR), $(VER_MICRO), 0
+ FILEFLAGSMASK 0x3fL
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+ #ifdef _DEBUG
+ #define VER_STR "$(VERSION).0 (MSVC debug)"
+ #define DBG "d"
+ FILEFLAGS 0x1L
+ #else
+ #define VER_STR "$(VERSION).0 (MSVC release)"
+ #define DBG ""
+ FILEFLAGS 0x0L
+ #endif
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "http://tatsuhiro-t.github.io/nghttp2/"
+ VALUE "FileDescription", "nghttp2; HTTP/2 C library"
+ VALUE "FileVersion", VER_STR
+ VALUE "InternalName", "nghttp2" DBG
+ VALUE "LegalCopyright", "The MIT License"
+ VALUE "LegalTrademarks", ""
+ VALUE "OriginalFilename", "nghttp2" DBG ".dll"
+ VALUE "ProductName", "NGHTTP2."
+ VALUE "ProductVersion", VER_STR
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+ END
+endef
+
+export RES_FILE
+
+$(OBJ_DIR)/nghttp2.rc: Makefile.MSVC
+ @echo 'Generating $@...'
+ @echo ' /* $(GENERATED). DO NOT EDIT.' > $@
+ @echo ' */' >> $@
+ @echo "$$RES_FILE" >> $@
+
+clean:
+ rm -f $(OBJ_DIR)/* includes/nghttp2/nghttp2ver.h
+ @echo
+
+vclean realclean: clean
+ - rm -rf $(OBJ_DIR)
+ - rm -f .depend.MSVC
+
+#
+# Use gcc to generated the dependencies. No MSVC specific args please!
+#
+REPLACE_R = 's/\(.*\)\.o: /\n$$(OBJ_DIR)\/r_\1.obj: /'
+REPLACE_D = 's/\(.*\)\.o: /\n$$(OBJ_DIR)\/d_\1.obj: /'
+
+depend: includes/nghttp2/nghttp2ver.h
+ @echo '# $(GENERATED). DO NOT EDIT.' > .depend.MSVC
+ gcc -MM $(CFLAGS) $(NGHTTP2_SRC) >> .depend.tmp
+ @echo '#' >> .depend.MSVC
+ @echo '# Release lib objects:' >> .depend.MSVC
+ sed -e $(REPLACE_R) .depend.tmp >> .depend.MSVC
+ @echo '#' >> .depend.MSVC
+ @echo '# Debug lib objects:' >> .depend.MSVC
+ sed -e $(REPLACE_D) .depend.tmp >> .depend.MSVC
+ rm -f .depend.tmp
+
+-include .depend.MSVC