Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Added support for compiling on MinGW platform #294

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
# IN THE SOFTWARE.

PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
ifeq ($(findstring mingw,$(PLATFORM)), mingw)
PLATFORM = mingw
endif

HELPER ?=
BINEXT ?=
ifeq (darwin,$(PLATFORM))
Expand All @@ -28,6 +32,10 @@ else ifeq (wine,$(PLATFORM))
CC = winegcc
BINEXT = .exe.so
HELPER = wine
else ifeq (mingw,$(PLATFORM))
CC = gcc
SONAME ?= libhttp_parser.2.6.2.dll
SOEXT ?= dll
else
SONAME ?= libhttp_parser.so.2.6.2
SOEXT ?= so
Expand All @@ -50,7 +58,11 @@ CFLAGS += -Wall -Wextra -Werror
CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA)
CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter
ifneq (mingw,$(PLATFORM))
CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
else
CFLAGS_LIB = $(CFLAGS_FAST)
endif

LDFLAGS_LIB = $(LDFLAGS) -shared

Expand Down Expand Up @@ -141,7 +153,7 @@ clean:
rm -f *.o *.a tags test test_fast test_g \
http_parser.tar libhttp_parser.so.* \
url_parser url_parser_g parsertrace parsertrace_g \
*.exe *.exe.so
*.exe *.exe.so *.dll

contrib/url_parser.c: http_parser.h
contrib/parsertrace.c: http_parser.h
Expand Down