"Fossies" - the Fresh Open Source Software Archive

Member "tcpflow-1.6.1/src/http-parser/Makefile" (19 Feb 2021, 5128 Bytes) of package /linux/misc/tcpflow-1.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "Makefile": 1.4.5_vs_1.5.0.

    1 # Copyright Joyent, Inc. and other Node contributors. All rights reserved.
    2 #
    3 # Permission is hereby granted, free of charge, to any person obtaining a copy
    4 # of this software and associated documentation files (the "Software"), to
    5 # deal in the Software without restriction, including without limitation the
    6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    7 # sell copies of the Software, and to permit persons to whom the Software is
    8 # furnished to do so, subject to the following conditions:
    9 #
   10 # The above copyright notice and this permission notice shall be included in
   11 # all copies or substantial portions of the Software.
   12 #
   13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
   19 # IN THE SOFTWARE.
   20 
   21 PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
   22 HELPER ?=
   23 BINEXT ?=
   24 SOLIBNAME = libhttp_parser
   25 SOMAJOR = 2
   26 SOMINOR = 7
   27 SOREV   = 1
   28 ifeq (darwin,$(PLATFORM))
   29 SOEXT ?= dylib
   30 SONAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOEXT)
   31 LIBNAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOREV).$(SOEXT)
   32 else ifeq (wine,$(PLATFORM))
   33 CC = winegcc
   34 BINEXT = .exe.so
   35 HELPER = wine
   36 else
   37 SOEXT ?= so
   38 SONAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR)
   39 LIBNAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR).$(SOREV)
   40 endif
   41 
   42 CC?=gcc
   43 AR?=ar
   44 
   45 CPPFLAGS ?=
   46 LDFLAGS ?=
   47 
   48 CPPFLAGS += -I.
   49 CPPFLAGS_DEBUG = $(CPPFLAGS) -DHTTP_PARSER_STRICT=1
   50 CPPFLAGS_DEBUG += $(CPPFLAGS_DEBUG_EXTRA)
   51 CPPFLAGS_FAST = $(CPPFLAGS) -DHTTP_PARSER_STRICT=0
   52 CPPFLAGS_FAST += $(CPPFLAGS_FAST_EXTRA)
   53 CPPFLAGS_BENCH = $(CPPFLAGS_FAST)
   54 
   55 CFLAGS += -Wall -Wextra -Werror
   56 CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA)
   57 CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
   58 CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter
   59 CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
   60 
   61 LDFLAGS_LIB = $(LDFLAGS) -shared
   62 
   63 INSTALL ?= install
   64 PREFIX ?= $(DESTDIR)/usr/local
   65 LIBDIR = $(PREFIX)/lib
   66 INCLUDEDIR = $(PREFIX)/include
   67 
   68 ifneq (darwin,$(PLATFORM))
   69 # TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname...
   70 LDFLAGS_LIB += -Wl,-soname=$(SONAME)
   71 endif
   72 
   73 test: test_g test_fast
   74 	$(HELPER) ./test_g$(BINEXT)
   75 	$(HELPER) ./test_fast$(BINEXT)
   76 
   77 test_g: http_parser_g.o test_g.o
   78 	$(CC) $(CFLAGS_DEBUG) $(LDFLAGS) http_parser_g.o test_g.o -o $@
   79 
   80 test_g.o: test.c http_parser.h Makefile
   81 	$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c test.c -o $@
   82 
   83 http_parser_g.o: http_parser.c http_parser.h Makefile
   84 	$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c http_parser.c -o $@
   85 
   86 test_fast: http_parser.o test.o http_parser.h
   87 	$(CC) $(CFLAGS_FAST) $(LDFLAGS) http_parser.o test.o -o $@
   88 
   89 test.o: test.c http_parser.h Makefile
   90 	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c test.c -o $@
   91 
   92 bench: http_parser.o bench.o
   93 	$(CC) $(CFLAGS_BENCH) $(LDFLAGS) http_parser.o bench.o -o $@
   94 
   95 bench.o: bench.c http_parser.h Makefile
   96 	$(CC) $(CPPFLAGS_BENCH) $(CFLAGS_BENCH) -c bench.c -o $@
   97 
   98 http_parser.o: http_parser.c http_parser.h Makefile
   99 	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c http_parser.c
  100 
  101 test-run-timed: test_fast
  102 	while(true) do time $(HELPER) ./test_fast$(BINEXT) > /dev/null; done
  103 
  104 test-valgrind: test_g
  105 	valgrind ./test_g
  106 
  107 libhttp_parser.o: http_parser.c http_parser.h Makefile
  108 	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o
  109 
  110 library: libhttp_parser.o
  111 	$(CC) $(LDFLAGS_LIB) -o $(LIBNAME) $<
  112 
  113 package: http_parser.o
  114 	$(AR) rcs libhttp_parser.a http_parser.o
  115 
  116 url_parser: http_parser.o contrib/url_parser.c
  117 	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o $@
  118 
  119 url_parser_g: http_parser_g.o contrib/url_parser.c
  120 	$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o $@
  121 
  122 parsertrace: http_parser.o contrib/parsertrace.c
  123 	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o parsertrace$(BINEXT)
  124 
  125 parsertrace_g: http_parser_g.o contrib/parsertrace.c
  126 	$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o parsertrace_g$(BINEXT)
  127 
  128 tags: http_parser.c http_parser.h test.c
  129 	ctags $^
  130 
  131 install: library
  132 	$(INSTALL) -D  http_parser.h $(INCLUDEDIR)/http_parser.h
  133 	$(INSTALL) -D $(LIBNAME) $(LIBDIR)/$(LIBNAME)
  134 	ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SONAME)
  135 	ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SOLIBNAME).$(SOEXT)
  136 
  137 install-strip: library
  138 	$(INSTALL) -D  http_parser.h $(INCLUDEDIR)/http_parser.h
  139 	$(INSTALL) -D -s $(LIBNAME) $(LIBDIR)/$(LIBNAME)
  140 	ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SONAME)
  141 	ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SOLIBNAME).$(SOEXT)
  142 
  143 uninstall:
  144 	rm $(INCLUDEDIR)/http_parser.h
  145 	rm $(LIBDIR)/$(SONAME)
  146 	rm $(LIBDIR)/libhttp_parser.so
  147 
  148 clean:
  149 	rm -f *.o *.a tags test test_fast test_g \
  150 		http_parser.tar libhttp_parser.so.* \
  151 		url_parser url_parser_g parsertrace parsertrace_g \
  152 		*.exe *.exe.so
  153 
  154 contrib/url_parser.c:	http_parser.h
  155 contrib/parsertrace.c:	http_parser.h
  156 
  157 .PHONY: clean package test-run test-run-timed test-valgrind install install-strip uninstall