Skip to content
Merged
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
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ endif

INSTALL ?= install
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
LIBDIR = $(PREFIX)/lib
INCLUDEDIR = $(PREFIX)/include

Expand All @@ -50,6 +51,15 @@ build/libllhttp.a: build/c/llhttp.o $(SSE42_OBJ) build/native/api.o \
build/native/http.o
$(AR) rcs $@ build/c/llhttp.o $(SSE42_OBJ) build/native/api.o build/native/http.o

build/libllhttp.pc: libllhttp.pc.in package.json
mkdir -p build
sed -e 's|@CMAKE_INSTALL_PREFIX@|$(PREFIX)|g' \
-e 's|@CMAKE_INSTALL_FULL_BINDIR@|$(BINDIR)|g' \
-e 's|@CMAKE_INSTALL_FULL_LIBDIR@|$(LIBDIR)|g' \
-e 's|@CMAKE_INSTALL_FULL_INCLUDEDIR@|$(INCLUDEDIR)|g' \
-e "s|@PROJECT_VERSION@|$$(node -p "require('./package.json').version")|g" \
$< > $@
Comment on lines +54 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum but why would you do that instead of using CMake? That feels brittle


build/c/llhttp.o: build/c/llhttp.c
$(CLANG) $(CFLAGS) $(INCLUDES) -c $< -o $@

Expand Down Expand Up @@ -120,11 +130,14 @@ test-c: build/libllhttp.a
build/libllhttp.a -o build/dispatch_test
./build/dispatch_test

install: build/libllhttp.a build/libllhttp.so
install: build/libllhttp.a build/libllhttp.so build/libllhttp.pc
$(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)
$(INSTALL) -d $(DESTDIR)$(LIBDIR)
$(INSTALL) -d $(DESTDIR)$(LIBDIR)/pkgconfig
$(INSTALL) -C build/llhttp.h $(DESTDIR)$(INCLUDEDIR)/llhttp.h
$(INSTALL) -C build/libllhttp.a $(DESTDIR)$(LIBDIR)/libllhttp.a
$(INSTALL) build/libllhttp.so $(DESTDIR)$(LIBDIR)/libllhttp.so
$(INSTALL) -m 644 build/libllhttp.pc $(DESTDIR)$(LIBDIR)/pkgconfig/libllhttp.pc

.PHONY: all generate clean release postversion github-release test-c
# Regenerate pkg-config metadata when installation paths change.
.PHONY: all generate clean release postversion github-release test-c install build/libllhttp.pc
Loading