11cb0ef41Sopenharmony_ci# 21cb0ef41Sopenharmony_ci# GNU Makefile for nghttp2 / MSVC. 31cb0ef41Sopenharmony_ci# 41cb0ef41Sopenharmony_ci# By G. Vanem <gvanem@yahoo.no> 2013 51cb0ef41Sopenharmony_ci# Updated 3/2015 by Remo Eichenberger @remoe 61cb0ef41Sopenharmony_ci# The MIT License apply. 71cb0ef41Sopenharmony_ci# 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciTHIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci_VERSION := $(shell grep AC_INIT ../configure.ac | cut -d'[' -f3 | sed -e 's/-DEV//g' -e 's/], //g') 121cb0ef41Sopenharmony_ci_VERSION := $(subst ., ,$(_VERSION)) 131cb0ef41Sopenharmony_ciVER_MAJOR := $(word 1,$(_VERSION)) 141cb0ef41Sopenharmony_ciVER_MINOR := $(word 2,$(_VERSION)) 151cb0ef41Sopenharmony_ciVER_MICRO := $(word 3,$(_VERSION)) 161cb0ef41Sopenharmony_ciVERSION := $(VER_MAJOR).$(VER_MINOR).$(VER_MICRO) 171cb0ef41Sopenharmony_ciVERSION_NUM := (($(VER_MAJOR) << 16) + ($(VER_MINOR) << 8) + $(VER_MICRO)) 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciGENERATED := 'Generated by $(realpath Makefile.MSVC)' 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ciOBJ_DIR := MSVC_obj 221cb0ef41Sopenharmony_ci#SUFFIX :=-vc90-mt-x86 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci# 251cb0ef41Sopenharmony_ci# Where to copy nghttp2.dll + lib + headers to. 261cb0ef41Sopenharmony_ci# Note: 'make install' is not in default targets. Do it explicitly. 271cb0ef41Sopenharmony_ci# 281cb0ef41Sopenharmony_ciTARGET_DIR ?= ../_VC_ROOT 291cb0ef41Sopenharmony_ciVC_ROOT := $(abspath $(TARGET_DIR)) 301cb0ef41Sopenharmony_ciINSTALL_BIN := $(VC_ROOT)/bin 311cb0ef41Sopenharmony_ciINSTALL_LIB := $(VC_ROOT)/lib 321cb0ef41Sopenharmony_ciINSTALL_HDR := $(VC_ROOT)/include 331cb0ef41Sopenharmony_ciDLL_R := $(OBJ_DIR)/nghttp2$(SUFFIX).dll 341cb0ef41Sopenharmony_ciDLL_D := $(OBJ_DIR)/nghttp2d$(SUFFIX).dll 351cb0ef41Sopenharmony_ciLIB_R := $(OBJ_DIR)/nghttp2-static.lib 361cb0ef41Sopenharmony_ciLIB_D := $(OBJ_DIR)/nghttp2d-static.lib 371cb0ef41Sopenharmony_ciIMP_R := $(OBJ_DIR)/nghttp2.lib 381cb0ef41Sopenharmony_ciIMP_D := $(OBJ_DIR)/nghttp2d.lib 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ci# 411cb0ef41Sopenharmony_ci# Build for DEBUG-model and RELEASE at the same time. 421cb0ef41Sopenharmony_ci# 431cb0ef41Sopenharmony_ciTARGETS := $(LIB_R) $(DLL_R) $(IMP_R) \ 441cb0ef41Sopenharmony_ci $(LIB_D) $(DLL_D) $(IMP_D) 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ciEXT_LIBS = 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ciNGHTTP2_PDB_R := $(OBJ_DIR)/nghttp2.pdb 491cb0ef41Sopenharmony_ciNGHTTP2_PDB_D := $(OBJ_DIR)/nghttp2d.pdb 501cb0ef41Sopenharmony_ci 511cb0ef41Sopenharmony_ciCC = cl 521cb0ef41Sopenharmony_ciLD := link 531cb0ef41Sopenharmony_ciAR := lib 541cb0ef41Sopenharmony_ci#CC := icl 551cb0ef41Sopenharmony_ci#LD := xilink 561cb0ef41Sopenharmony_ci#AR := xilib 571cb0ef41Sopenharmony_ciRC := rc 581cb0ef41Sopenharmony_ciCFLAGS := -I./includes -Dssize_t=long 591cb0ef41Sopenharmony_ci 601cb0ef41Sopenharmony_ciCFLAGS_R := -nologo -MD -W3 -Z7 -DBUILDING_NGHTTP2 611cb0ef41Sopenharmony_ciCFLAGS_D := -nologo -MDd -W3 -Z7 -DBUILDING_NGHTTP2 \ 621cb0ef41Sopenharmony_ci -Ot -D_DEBUG -GF -RTCs -RTCu # -RTCc -GS 631cb0ef41Sopenharmony_ci 641cb0ef41Sopenharmony_ciLDFLAGS := -nologo -MAP -debug -incremental:no -opt:ref,icf -MANIFEST # -verbose 651cb0ef41Sopenharmony_ci 661cb0ef41Sopenharmony_ci 671cb0ef41Sopenharmony_ciNGHTTP2_SRC := nghttp2_pq.c \ 681cb0ef41Sopenharmony_ci nghttp2_map.c \ 691cb0ef41Sopenharmony_ci nghttp2_queue.c \ 701cb0ef41Sopenharmony_ci nghttp2_frame.c \ 711cb0ef41Sopenharmony_ci nghttp2_buf.c \ 721cb0ef41Sopenharmony_ci nghttp2_stream.c \ 731cb0ef41Sopenharmony_ci nghttp2_outbound_item.c \ 741cb0ef41Sopenharmony_ci nghttp2_session.c \ 751cb0ef41Sopenharmony_ci nghttp2_submit.c \ 761cb0ef41Sopenharmony_ci nghttp2_helper.c \ 771cb0ef41Sopenharmony_ci nghttp2_npn.c \ 781cb0ef41Sopenharmony_ci nghttp2_hd.c \ 791cb0ef41Sopenharmony_ci nghttp2_hd_huffman.c \ 801cb0ef41Sopenharmony_ci nghttp2_hd_huffman_data.c \ 811cb0ef41Sopenharmony_ci nghttp2_version.c \ 821cb0ef41Sopenharmony_ci nghttp2_priority_spec.c \ 831cb0ef41Sopenharmony_ci nghttp2_option.c \ 841cb0ef41Sopenharmony_ci nghttp2_callbacks.c \ 851cb0ef41Sopenharmony_ci nghttp2_mem.c \ 861cb0ef41Sopenharmony_ci nghttp2_http.c \ 871cb0ef41Sopenharmony_ci nghttp2_rcbuf.c 881cb0ef41Sopenharmony_ci 891cb0ef41Sopenharmony_ciNGHTTP2_OBJ_R := $(addprefix $(OBJ_DIR)/r_, $(notdir $(NGHTTP2_SRC:.c=.obj))) 901cb0ef41Sopenharmony_ciNGHTTP2_OBJ_D := $(addprefix $(OBJ_DIR)/d_, $(notdir $(NGHTTP2_SRC:.c=.obj))) 911cb0ef41Sopenharmony_ci 921cb0ef41Sopenharmony_ci.PHONY: all intro test_ver install copy_headers_and_libs \ 931cb0ef41Sopenharmony_ci install_nghttp2_pyd_0 install_nghttp2_pyd_1 \ 941cb0ef41Sopenharmony_ci build_nghttp2_pyd_0 build_nghttp2_pyd_1 \ 951cb0ef41Sopenharmony_ci clean_nghttp2_pyd_0 clean_nghttp2_pyd_1 961cb0ef41Sopenharmony_ci 971cb0ef41Sopenharmony_ci 981cb0ef41Sopenharmony_ciall: intro includes/nghttp2/nghttp2ver.h $(OBJ_DIR) $(TARGETS) 991cb0ef41Sopenharmony_ci @echo 'Welcome to NgHTTP2 (release + debug).' 1001cb0ef41Sopenharmony_ci @echo 'Do a "make -f Makefile.MSVC install" at own risk!' 1011cb0ef41Sopenharmony_ci 1021cb0ef41Sopenharmony_ciintro: 1031cb0ef41Sopenharmony_ci @echo 'Building NgHTTP (MSVC) ver. "$(VERSION)".' 1041cb0ef41Sopenharmony_ci 1051cb0ef41Sopenharmony_citest_ver: 1061cb0ef41Sopenharmony_ci @echo '$$(VERSION): "$(VERSION)".' 1071cb0ef41Sopenharmony_ci @echo '$$(_VERSION): "$(_VERSION)".' 1081cb0ef41Sopenharmony_ci @echo '$$(VER_MAJOR): "$(VER_MAJOR)".' 1091cb0ef41Sopenharmony_ci @echo '$$(VER_MINOR): "$(VER_MINOR)".' 1101cb0ef41Sopenharmony_ci @echo '$$(VER_MICRO): "$(VER_MICRO)".' 1111cb0ef41Sopenharmony_ci 1121cb0ef41Sopenharmony_ci$(OBJ_DIR): 1131cb0ef41Sopenharmony_ci - mkdir $(OBJ_DIR) 1141cb0ef41Sopenharmony_ci 1151cb0ef41Sopenharmony_ciinstall: includes/nghttp2/nghttp2.h includes/nghttp2/nghttp2ver.h \ 1161cb0ef41Sopenharmony_ci $(TARGETS) \ 1171cb0ef41Sopenharmony_ci copy_headers_and_libs 1181cb0ef41Sopenharmony_ci 1191cb0ef41Sopenharmony_ci# 1201cb0ef41Sopenharmony_ci# This MUST be done before using the 'install_nghttp2_pyd_1' rule. 1211cb0ef41Sopenharmony_ci# 1221cb0ef41Sopenharmony_cicopy_headers_and_libs: 1231cb0ef41Sopenharmony_ci - mkdir -p $(INSTALL_HDR)/nghttp2 $(INSTALL_BIN) $(INSTALL_LIB) 1241cb0ef41Sopenharmony_ci cp --update $(addprefix includes/nghttp2/, nghttp2.h nghttp2ver.h) $(INSTALL_HDR)/nghttp2 1251cb0ef41Sopenharmony_ci cp --update $(DLL_R) $(DLL_D) $(NGHTTP2_PDB_R) $(NGHTTP2_PDB_D) $(INSTALL_BIN) 1261cb0ef41Sopenharmony_ci cp --update $(IMP_R) $(IMP_D) $(LIB_R) $(LIB_D) $(INSTALL_LIB) 1271cb0ef41Sopenharmony_ci @echo 1281cb0ef41Sopenharmony_ci 1291cb0ef41Sopenharmony_ci$(LIB_R): $(NGHTTP2_OBJ_R) 1301cb0ef41Sopenharmony_ci $(AR) -nologo -out:$@ $^ 1311cb0ef41Sopenharmony_ci @echo 1321cb0ef41Sopenharmony_ci 1331cb0ef41Sopenharmony_ci$(LIB_D): $(NGHTTP2_OBJ_D) 1341cb0ef41Sopenharmony_ci $(AR) -nologo -out:$@ $^ 1351cb0ef41Sopenharmony_ci @echo 1361cb0ef41Sopenharmony_ci 1371cb0ef41Sopenharmony_ci 1381cb0ef41Sopenharmony_ci$(IMP_R): $(DLL_R) 1391cb0ef41Sopenharmony_ci 1401cb0ef41Sopenharmony_ci$(DLL_R): $(NGHTTP2_OBJ_R) $(OBJ_DIR)/r_nghttp2.res 1411cb0ef41Sopenharmony_ci $(LD) $(LDFLAGS) -dll -out:$@ -implib:$(IMP_R) $(NGHTTP2_OBJ_R) -PDB:$(NGHTTP2_PDB_R) $(OBJ_DIR)/r_nghttp2.res $(EXT_LIBS) 1421cb0ef41Sopenharmony_ci mt -nologo -manifest $@.manifest -outputresource:$@\;2 1431cb0ef41Sopenharmony_ci @echo 1441cb0ef41Sopenharmony_ci 1451cb0ef41Sopenharmony_ci$(IMP_D): $(DLL_D) 1461cb0ef41Sopenharmony_ci 1471cb0ef41Sopenharmony_ci$(DLL_D): $(NGHTTP2_OBJ_D) $(OBJ_DIR)/d_nghttp2.res 1481cb0ef41Sopenharmony_ci $(LD) $(LDFLAGS) -dll -out:$@ -implib:$(IMP_D) $(NGHTTP2_OBJ_D) -PDB:$(NGHTTP2_PDB_D) $(OBJ_DIR)/d_nghttp2.res $(EXT_LIBS) 1491cb0ef41Sopenharmony_ci mt -nologo -manifest $@.manifest -outputresource:$@\;2 1501cb0ef41Sopenharmony_ci @echo 1511cb0ef41Sopenharmony_ci 1521cb0ef41Sopenharmony_ci 1531cb0ef41Sopenharmony_ciWIN_OBJDIR:=$(shell cygpath -w $(abspath $(OBJ_DIR))) 1541cb0ef41Sopenharmony_ciWIN_OBJDIR:=$(subst \,/,$(WIN_OBJDIR)) 1551cb0ef41Sopenharmony_ci 1561cb0ef41Sopenharmony_ci$(OBJ_DIR)/r_%.obj: %.c $(THIS_MAKEFILE) 1571cb0ef41Sopenharmony_ci $(CC) $(CFLAGS_R) $(CFLAGS) -Fo$@ -c $< 1581cb0ef41Sopenharmony_ci @echo 1591cb0ef41Sopenharmony_ci 1601cb0ef41Sopenharmony_ci$(OBJ_DIR)/d_%.obj: %.c $(THIS_MAKEFILE) 1611cb0ef41Sopenharmony_ci $(CC) $(CFLAGS_D) $(CFLAGS) -Fo$@ -c $< 1621cb0ef41Sopenharmony_ci @echo 1631cb0ef41Sopenharmony_ci 1641cb0ef41Sopenharmony_ci$(OBJ_DIR)/r_nghttp2.res: $(OBJ_DIR)/nghttp2.rc $(THIS_MAKEFILE) 1651cb0ef41Sopenharmony_ci $(RC) -D_RELEASE -Fo $@ $< 1661cb0ef41Sopenharmony_ci @echo 1671cb0ef41Sopenharmony_ci 1681cb0ef41Sopenharmony_ci$(OBJ_DIR)/d_nghttp2.res: $(OBJ_DIR)/nghttp2.rc $(THIS_MAKEFILE) 1691cb0ef41Sopenharmony_ci $(RC) -D_DEBUG -Fo $@ $< 1701cb0ef41Sopenharmony_ci @echo 1711cb0ef41Sopenharmony_ci 1721cb0ef41Sopenharmony_ciincludes/nghttp2/nghttp2ver.h: includes/nghttp2/nghttp2ver.h.in $(THIS_MAKEFILE) 1731cb0ef41Sopenharmony_ci sed < includes/nghttp2/nghttp2ver.h.in \ 1741cb0ef41Sopenharmony_ci -e 's/@PACKAGE_VERSION@/$(VERSION)/g' \ 1751cb0ef41Sopenharmony_ci -e 's/@PACKAGE_VERSION_NUM@/$(VERSION_NUM)/g' > $@ 1761cb0ef41Sopenharmony_ci touch --reference=includes/nghttp2/nghttp2ver.h.in $@ 1771cb0ef41Sopenharmony_ci 1781cb0ef41Sopenharmony_ci 1791cb0ef41Sopenharmony_cidefine RES_FILE 1801cb0ef41Sopenharmony_ci #include <winver.h> 1811cb0ef41Sopenharmony_ci 1821cb0ef41Sopenharmony_ci VS_VERSION_INFO VERSIONINFO 1831cb0ef41Sopenharmony_ci FILEVERSION $(VER_MAJOR), $(VER_MINOR), $(VER_MICRO), 0 1841cb0ef41Sopenharmony_ci PRODUCTVERSION $(VER_MAJOR), $(VER_MINOR), $(VER_MICRO), 0 1851cb0ef41Sopenharmony_ci FILEFLAGSMASK 0x3fL 1861cb0ef41Sopenharmony_ci FILEOS 0x40004L 1871cb0ef41Sopenharmony_ci FILETYPE 0x2L 1881cb0ef41Sopenharmony_ci FILESUBTYPE 0x0L 1891cb0ef41Sopenharmony_ci #ifdef _DEBUG 1901cb0ef41Sopenharmony_ci #define VER_STR "$(VERSION).0 (MSVC debug)" 1911cb0ef41Sopenharmony_ci #define DBG "d" 1921cb0ef41Sopenharmony_ci FILEFLAGS 0x1L 1931cb0ef41Sopenharmony_ci #else 1941cb0ef41Sopenharmony_ci #define VER_STR "$(VERSION).0 (MSVC release)" 1951cb0ef41Sopenharmony_ci #define DBG "" 1961cb0ef41Sopenharmony_ci FILEFLAGS 0x0L 1971cb0ef41Sopenharmony_ci #endif 1981cb0ef41Sopenharmony_ci BEGIN 1991cb0ef41Sopenharmony_ci BLOCK "StringFileInfo" 2001cb0ef41Sopenharmony_ci BEGIN 2011cb0ef41Sopenharmony_ci BLOCK "040904b0" 2021cb0ef41Sopenharmony_ci BEGIN 2031cb0ef41Sopenharmony_ci VALUE "CompanyName", "http://tatsuhiro-t.github.io/nghttp2/" 2041cb0ef41Sopenharmony_ci VALUE "FileDescription", "nghttp2; HTTP/2 C library" 2051cb0ef41Sopenharmony_ci VALUE "FileVersion", VER_STR 2061cb0ef41Sopenharmony_ci VALUE "InternalName", "nghttp2" DBG 2071cb0ef41Sopenharmony_ci VALUE "LegalCopyright", "The MIT License" 2081cb0ef41Sopenharmony_ci VALUE "LegalTrademarks", "" 2091cb0ef41Sopenharmony_ci VALUE "OriginalFilename", "nghttp2" DBG ".dll" 2101cb0ef41Sopenharmony_ci VALUE "ProductName", "NGHTTP2." 2111cb0ef41Sopenharmony_ci VALUE "ProductVersion", VER_STR 2121cb0ef41Sopenharmony_ci END 2131cb0ef41Sopenharmony_ci END 2141cb0ef41Sopenharmony_ci BLOCK "VarFileInfo" 2151cb0ef41Sopenharmony_ci BEGIN 2161cb0ef41Sopenharmony_ci VALUE "Translation", 0x409, 1200 2171cb0ef41Sopenharmony_ci END 2181cb0ef41Sopenharmony_ci END 2191cb0ef41Sopenharmony_ciendef 2201cb0ef41Sopenharmony_ci 2211cb0ef41Sopenharmony_ciexport RES_FILE 2221cb0ef41Sopenharmony_ci 2231cb0ef41Sopenharmony_ci$(OBJ_DIR)/nghttp2.rc: Makefile.MSVC 2241cb0ef41Sopenharmony_ci @echo 'Generating $@...' 2251cb0ef41Sopenharmony_ci @echo ' /* $(GENERATED). DO NOT EDIT.' > $@ 2261cb0ef41Sopenharmony_ci @echo ' */' >> $@ 2271cb0ef41Sopenharmony_ci @echo "$$RES_FILE" >> $@ 2281cb0ef41Sopenharmony_ci 2291cb0ef41Sopenharmony_ciclean: 2301cb0ef41Sopenharmony_ci rm -f $(OBJ_DIR)/* includes/nghttp2/nghttp2ver.h 2311cb0ef41Sopenharmony_ci @echo 2321cb0ef41Sopenharmony_ci 2331cb0ef41Sopenharmony_civclean realclean: clean 2341cb0ef41Sopenharmony_ci - rm -rf $(OBJ_DIR) 2351cb0ef41Sopenharmony_ci - rm -f .depend.MSVC 2361cb0ef41Sopenharmony_ci 2371cb0ef41Sopenharmony_ci# 2381cb0ef41Sopenharmony_ci# Use gcc to generated the dependencies. No MSVC specific args please! 2391cb0ef41Sopenharmony_ci# 2401cb0ef41Sopenharmony_ciREPLACE_R = 's/\(.*\)\.o: /\n$$(OBJ_DIR)\/r_\1.obj: /' 2411cb0ef41Sopenharmony_ciREPLACE_D = 's/\(.*\)\.o: /\n$$(OBJ_DIR)\/d_\1.obj: /' 2421cb0ef41Sopenharmony_ci 2431cb0ef41Sopenharmony_cidepend: includes/nghttp2/nghttp2ver.h 2441cb0ef41Sopenharmony_ci @echo '# $(GENERATED). DO NOT EDIT.' > .depend.MSVC 2451cb0ef41Sopenharmony_ci gcc -MM $(CFLAGS) $(NGHTTP2_SRC) >> .depend.tmp 2461cb0ef41Sopenharmony_ci @echo '#' >> .depend.MSVC 2471cb0ef41Sopenharmony_ci @echo '# Release lib objects:' >> .depend.MSVC 2481cb0ef41Sopenharmony_ci sed -e $(REPLACE_R) .depend.tmp >> .depend.MSVC 2491cb0ef41Sopenharmony_ci @echo '#' >> .depend.MSVC 2501cb0ef41Sopenharmony_ci @echo '# Debug lib objects:' >> .depend.MSVC 2511cb0ef41Sopenharmony_ci sed -e $(REPLACE_D) .depend.tmp >> .depend.MSVC 2521cb0ef41Sopenharmony_ci rm -f .depend.tmp 2531cb0ef41Sopenharmony_ci 2541cb0ef41Sopenharmony_ci-include .depend.MSVC 255