aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2020-08-07 22:23:46 -0400
committerJason Woodward2020-08-07 22:24:06 -0400
commit6abd493250d18b19ca704721f46782847d5309e4 (patch)
tree7b8214c7ec4c0b8f90873a65357d33516357b717
parent3262a60b42436cc2a43ffb1778935db2d8836fa1 (diff)
downloadslapt-get-6abd493250d18b19ca704721f46782847d5309e4.tar.gz
Makefile: enable LTO
-rw-r--r--Makefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index e279c3b..bc8466c 100644
--- a/Makefile
+++ b/Makefile
@@ -27,9 +27,9 @@ ifeq ($(HAS_GPGME),1)
LDFLAGS+=`gpgme-config --libs`
endif
ifeq ($(TESTBUILD),1)
-CFLAGS?=-W -Werror -Wall -Wextra -O2 -pedantic -Wshadow -Wstrict-overflow -fno-strict-aliasing -g -fsanitize=undefined -fsanitize=address -fstack-protector -ggdb -fno-omit-frame-pointer
+CFLAGS?=-W -Werror -Wall -Wextra -O2 -flto -pedantic -Wshadow -Wstrict-overflow -fno-strict-aliasing -g -fsanitize=undefined -fsanitize=address -fstack-protector -ggdb -fno-omit-frame-pointer
else
-CFLAGS?=-W -Werror -Wall -Wextra -O2 -pedantic -Wshadow -Wstrict-overflow -fno-strict-aliasing -g
+CFLAGS?=-W -Werror -Wall -Wextra -O2 -flto -pedantic -Wshadow -Wstrict-overflow -fno-strict-aliasing -g
endif
CFLAGS+=$(DEFINES) -fPIC
@@ -40,7 +40,11 @@ all: pkg
$(OBJS): $(LIBHEADERS)
$(PACKAGE): libs
+ifeq ($(TESTBUILD),1)
+ $(CC) -o $(PACKAGE) $(OBJS) $(CFLAGS) $(LDFLAGS)
+else
$(CC) -o $(PACKAGE) $(NONLIBOBJS) -L./src -Wl,-R$(LIBDIR) $(CFLAGS) $(LDFLAGS) -lslapt
+endif
install: $(PACKAGE) doinstall
@@ -153,7 +157,7 @@ po_file:
libs: $(OBJS)
touch libs
- $(CC) -shared -o src/libslapt.so.$(VERSION) $(LIBOBJS) -Wl,-soname=libslapt.so.$(VERSION)
+ $(CC) -shared -o src/libslapt.so.$(VERSION) $(LIBOBJS) -Wl,-soname=libslapt.so.$(VERSION) $(CFLAGS) $(LDFLAGS)
( cd src; if [ -f libslapt.so ]; then rm libslapt.so;fi; ln -sf libslapt.so.$(VERSION) libslapt.so )
-@echo "#ifndef LIB_SLAPT" > src/slapt.h
-@echo "#define LIB_SLAPT 1" >> src/slapt.h