lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1579422387-30552-1-git-send-email-teawater@gmail.com>
Date:   Sun, 19 Jan 2020 16:26:27 +0800
From:   Hui Zhu <teawater@...il.com>
To:     fengguang.wu@...el.com, linux-kernel@...r.kernel.org
Cc:     Hui Zhu <teawater@...il.com>, Hui Zhu <teawaterz@...ux.alibaba.com>
Subject: [PATCH for vm-scalability] Makefile: Add static build option

Sometimes vm-scalability needs to work in an environment without an
libraries.  Supporting static build is helpful.

This commit add static build option:
make STATIC=1

Signed-off-by: Hui Zhu <teawaterz@...ux.alibaba.com>
---
 Makefile | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 73b2ff3..eadc090 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,13 @@ EXECUTABLES :=	usemem \
 		usemem_direct_write \
 		usemem_mbind
 
+ifdef STATIC
+	EXTRA_LDFLAGS := -static
+else
+	EXTRA_LDFLAGS :=
+endif
+
+
 all:	$(EXECUTABLES)
 
 clean:
@@ -15,31 +22,31 @@ distclean: clean
 	rm -f $(EXECUTABLES)
 
 usemem: usemem.o usemem_hugepages.o usemem_mincore.o
-	gcc -pthread -Wall -O -g usemem_mincore.o usemem_hugepages.o usemem.o -o usemem
+	gcc -pthread -Wall -O -g $(EXTRA_LDFLAGS) usemem_mincore.o usemem_hugepages.o usemem.o -o usemem
 
 usemem.o: usemem.c
-	gcc -O -c -Wall -g  usemem.c -o usemem.o
+	gcc -O -c -Wall -g $(EXTRA_LDFLAGS) usemem.c -o usemem.o
 
 usemem_hugepages.o: usemem_hugepages.c
-	gcc -Wall -O -c -g usemem_hugepages.c -o usemem_hugepages.o
+	gcc -Wall -O -c -g $(EXTRA_LDFLAGS) usemem_hugepages.c -o usemem_hugepages.o
 
 usemem_mincore.o: usemem_mincore.c
-	gcc -Wall -O -c -g usemem_mincore.c -o usemem_mincore.o
+	gcc -Wall -O -c -g $(EXTRA_LDFLAGS) usemem_mincore.c -o usemem_mincore.o
 
 usemem_migrate: usemem_migrate.c
-	gcc -Wall -O -g -o usemem_migrate usemem_migrate.c -lnuma
+	gcc -Wall -O -g $(EXTRA_LDFLAGS) -o usemem_migrate usemem_migrate.c -lnuma
 
 usemem_ksm: usemem_ksm.c usemem_hugepages.c
-	gcc -Wall -g -o usemem_ksm usemem_ksm.c usemem_hugepages.c
+	gcc -Wall -g $(EXTRA_LDFLAGS) -o usemem_ksm usemem_ksm.c usemem_hugepages.c
 
 usemem_mbind: usemem_mbind.c
-	gcc -Wall -g -o usemem_mbind usemem_mbind.c -lnuma
+	gcc -Wall -g $(EXTRA_LDFLAGS) -o usemem_mbind usemem_mbind.c -lnuma
 
 usemem_ksm_hugepages: usemem_ksm_hugepages.c
-	gcc -Wall -g -o usemem_ksm_hugepages usemem_ksm_hugepages.c
+	gcc -Wall -g $(EXTRA_LDFLAGS) -o usemem_ksm_hugepages usemem_ksm_hugepages.c
 
 usemem_direct_write: usemem_direct_write.c
-	gcc -Wall -g -o usemem_direct_write usemem_direct_write.c
+	gcc -Wall -g $(EXTRA_LDFLAGS) -o usemem_direct_write usemem_direct_write.c
 
 usemem_remap: usemem_remap.c
-	gcc -Wall -g -o usemem_remap usemem_remap.c
+	gcc -Wall -g $(EXTRA_LDFLAGS) -o usemem_remap usemem_remap.c
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ