2014-08-27 16:54:29 +02:00
|
|
|
#
|
|
|
|
# GNU Makefile for nghttp2 / MSVC.
|
|
|
|
#
|
|
|
|
# By G. Vanem <gvanem@yahoo.no> 2013
|
2015-03-27 21:54:44 +01:00
|
|
|
# Updated 3/2015 by Remo Eichenberger @remoe
|
2014-08-27 16:54:29 +02:00
|
|
|
# The MIT License apply.
|
|
|
|
#
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
2014-08-27 16:54:29 +02:00
|
|
|
|
2016-03-13 18:18:22 +01:00
|
|
|
_VERSION := $(shell grep AC_INIT ../configure.ac | cut -d'[' -f3 | sed -e 's/-DEV//g' -e 's/], //g')
|
2015-07-04 22:07:30 +02:00
|
|
|
_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)
|
2016-03-14 14:13:19 +01:00
|
|
|
VERSION_NUM := (($(VER_MAJOR) << 16) + ($(VER_MINOR) << 8) + $(VER_MICRO))
|
2015-07-04 22:07:30 +02:00
|
|
|
|
|
|
|
GENERATED := 'Generated by $(realpath Makefile.MSVC)'
|
|
|
|
|
|
|
|
OBJ_DIR := MSVC_obj
|
|
|
|
#SUFFIX :=-vc90-mt-x86
|
2014-08-27 16:54:29 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Where to copy nghttp2.dll + lib + headers to.
|
|
|
|
# Note: 'make install' is not in default targets. Do it explicitly.
|
|
|
|
#
|
2015-07-04 22:07:30 +02:00
|
|
|
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
|
2014-08-27 16:54:29 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build for DEBUG-model and RELEASE at the same time.
|
|
|
|
#
|
2015-07-04 22:07:30 +02:00
|
|
|
TARGETS := $(LIB_R) $(DLL_R) $(IMP_R) \
|
|
|
|
$(LIB_D) $(DLL_D) $(IMP_D)
|
2014-08-27 16:54:29 +02:00
|
|
|
|
2015-04-03 12:00:06 +02:00
|
|
|
EXT_LIBS =
|
2014-08-27 16:54:29 +02:00
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
NGHTTP2_PDB_R := $(OBJ_DIR)/nghttp2.pdb
|
|
|
|
NGHTTP2_PDB_D := $(OBJ_DIR)/nghttp2d.pdb
|
2014-08-27 16:54:29 +02:00
|
|
|
|
|
|
|
CC = cl
|
2015-07-04 22:07:30 +02:00
|
|
|
LD := link
|
|
|
|
AR := lib
|
|
|
|
#CC := icl
|
|
|
|
#LD := xilink
|
|
|
|
#AR := xilib
|
|
|
|
RC := rc
|
2017-03-11 09:46:39 +01:00
|
|
|
CFLAGS := -I./includes -Dssize_t=long
|
2015-07-04 22:07:30 +02:00
|
|
|
|
|
|
|
CFLAGS_R := -nologo -MD -W3 -Z7 -DBUILDING_NGHTTP2
|
|
|
|
CFLAGS_D := -nologo -MDd -W3 -Z7 -DBUILDING_NGHTTP2 \
|
2014-08-27 16:54:29 +02:00
|
|
|
-Ot -D_DEBUG -GF -RTCs -RTCu # -RTCc -GS
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
LDFLAGS := -nologo -MAP -debug -incremental:no -opt:ref,icf -MANIFEST # -verbose
|
|
|
|
|
2015-03-27 21:54:44 +01:00
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
NGHTTP2_SRC := nghttp2_pq.c \
|
2015-03-27 21:54:44 +01:00
|
|
|
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 \
|
2016-03-13 18:12:39 +01:00
|
|
|
nghttp2_http.c \
|
2021-05-15 06:51:24 +02:00
|
|
|
nghttp2_rcbuf.c
|
2014-08-27 16:54:29 +02:00
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
NGHTTP2_OBJ_R := $(addprefix $(OBJ_DIR)/r_, $(notdir $(NGHTTP2_SRC:.c=.obj)))
|
|
|
|
NGHTTP2_OBJ_D := $(addprefix $(OBJ_DIR)/d_, $(notdir $(NGHTTP2_SRC:.c=.obj)))
|
2014-08-27 16:54:29 +02:00
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
.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
|
|
|
|
|
|
|
|
|
2022-12-24 10:23:18 +01:00
|
|
|
all: intro includes/nghttp2/nghttp2ver.h $(OBJ_DIR) $(TARGETS)
|
2014-08-27 16:54:29 +02:00
|
|
|
@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 \
|
2015-07-04 22:07:30 +02:00
|
|
|
$(TARGETS) \
|
2022-12-24 10:23:18 +01:00
|
|
|
copy_headers_and_libs
|
2014-08-27 16:54:29 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# This MUST be done before using the 'install_nghttp2_pyd_1' rule.
|
|
|
|
#
|
|
|
|
copy_headers_and_libs:
|
2015-07-04 22:07:30 +02:00
|
|
|
- mkdir -p $(INSTALL_HDR)/nghttp2 $(INSTALL_BIN) $(INSTALL_LIB)
|
2014-08-27 16:54:29 +02:00
|
|
|
cp --update $(addprefix includes/nghttp2/, nghttp2.h nghttp2ver.h) $(INSTALL_HDR)/nghttp2
|
2015-07-04 22:07:30 +02:00
|
|
|
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)
|
2014-08-27 16:54:29 +02:00
|
|
|
@echo
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
$(LIB_R): $(NGHTTP2_OBJ_R)
|
|
|
|
$(AR) -nologo -out:$@ $^
|
2014-08-27 16:54:29 +02:00
|
|
|
@echo
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
$(LIB_D): $(NGHTTP2_OBJ_D)
|
|
|
|
$(AR) -nologo -out:$@ $^
|
2014-08-27 16:54:29 +02:00
|
|
|
@echo
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
|
|
|
|
$(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
|
2014-08-27 16:54:29 +02:00
|
|
|
@echo
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
$(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
|
2014-08-27 16:54:29 +02:00
|
|
|
@echo
|
|
|
|
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
WIN_OBJDIR:=$(shell cygpath -w $(abspath $(OBJ_DIR)))
|
|
|
|
WIN_OBJDIR:=$(subst \,/,$(WIN_OBJDIR))
|
|
|
|
|
|
|
|
$(OBJ_DIR)/r_%.obj: %.c $(THIS_MAKEFILE)
|
2014-08-27 16:54:29 +02:00
|
|
|
$(CC) $(CFLAGS_R) $(CFLAGS) -Fo$@ -c $<
|
|
|
|
@echo
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
$(OBJ_DIR)/d_%.obj: %.c $(THIS_MAKEFILE)
|
2014-08-27 16:54:29 +02:00
|
|
|
$(CC) $(CFLAGS_D) $(CFLAGS) -Fo$@ -c $<
|
|
|
|
@echo
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
$(OBJ_DIR)/r_nghttp2.res: $(OBJ_DIR)/nghttp2.rc $(THIS_MAKEFILE)
|
2016-03-13 18:31:14 +01:00
|
|
|
$(RC) -D_RELEASE -Fo $@ $<
|
2014-08-27 16:54:29 +02:00
|
|
|
@echo
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
$(OBJ_DIR)/d_nghttp2.res: $(OBJ_DIR)/nghttp2.rc $(THIS_MAKEFILE)
|
2016-03-13 18:31:14 +01:00
|
|
|
$(RC) -D_DEBUG -Fo $@ $<
|
2014-08-27 16:54:29 +02:00
|
|
|
@echo
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
includes/nghttp2/nghttp2ver.h: includes/nghttp2/nghttp2ver.h.in $(THIS_MAKEFILE)
|
2014-08-27 16:54:29 +02:00
|
|
|
sed < includes/nghttp2/nghttp2ver.h.in \
|
|
|
|
-e 's/@PACKAGE_VERSION@/$(VERSION)/g' \
|
2016-03-13 18:43:44 +01:00
|
|
|
-e 's/@PACKAGE_VERSION_NUM@/$(VERSION_NUM)/g' > $@
|
2014-08-27 16:54:29 +02:00
|
|
|
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
|
|
|
|
|
2015-07-04 22:07:30 +02:00
|
|
|
$(OBJ_DIR)/nghttp2.rc: Makefile.MSVC
|
2014-08-27 16:54:29 +02:00
|
|
|
@echo 'Generating $@...'
|
|
|
|
@echo ' /* $(GENERATED). DO NOT EDIT.' > $@
|
|
|
|
@echo ' */' >> $@
|
|
|
|
@echo "$$RES_FILE" >> $@
|
|
|
|
|
|
|
|
clean:
|
2015-07-04 22:07:30 +02:00
|
|
|
rm -f $(OBJ_DIR)/* includes/nghttp2/nghttp2ver.h
|
2014-08-27 16:54:29 +02:00
|
|
|
@echo
|
|
|
|
|
2022-12-24 10:23:18 +01:00
|
|
|
vclean realclean: clean
|
2015-07-04 22:07:30 +02:00
|
|
|
- rm -rf $(OBJ_DIR)
|
|
|
|
- rm -f .depend.MSVC
|
2014-08-27 16:54:29 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2015-04-03 12:00:06 +02:00
|
|
|
-include .depend.MSVC
|