From 9ecbc894ed6887fb27a759ddd89852afdcc74e44 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Wed, 3 Mar 2021 10:40:41 +0900 Subject: [PATCH] Build against tcmalloc on win32 --- .gitignore | 1 + Makefile | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3c0fd11..f3806ee 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ *.dll *.dSYM *.kbc +*.a diff --git a/Makefile b/Makefile index 677402e..fca2921 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ KRKMODS = $(wildcard modules/*.krk modules/*/*.krk modules/*/*/*.krk) ifndef KRK_ENABLE_STATIC # The normal build configuration is as a shared library or DLL (on Windows) + all: ${TARGET} ${MODULES} ${TOOLS} CFLAGS += -fPIC ifeq (,$(findstring mingw,$(CC))) # We set rpath here mostly so you can run the locally-built interpreter @@ -34,10 +35,10 @@ ifndef KRK_ENABLE_STATIC # And we need to link this by name with extension because I don't want # to actually rename it to kuroko.dll or whatever. MODLIBS = libkuroko.so - LDLIBS += -l:libwinpthread.a + LDLIBS += -l:libwinpthread.a -Wl,--require-defined=tc_malloc libtcmalloc_minimal.a -l:libpsapi.a -l:libstdc++.a ${OBJS}: CFLAGS += -DKRKINLIB + libkuroko.so: libtcmalloc_minimal.a endif - all: ${TARGET} ${MODULES} ${TOOLS} KUROKO_LIBS = libkuroko.so else # Static builds are a little different... @@ -119,6 +120,9 @@ clean: tags: $(wildcard src/*.c) $(wildcard src/*.h) @ctags --c-kinds=+lx src/*.c src/*.h +libtcmalloc_minimal.a: + curl -O https://klange.dev/libtcmalloc_minimal.a + # Test targets run against all .krk files in the test/ directory, writing # stdout to `.expect` files, and then comparing with `git`. # To update the tests if changes are expected, run `make test` and commit the result.