Build with -fstack-protector and executables as PIE

This commit is contained in:
Pierre Pronchery 2015-07-12 18:21:36 +02:00
parent 1035c9bf0f
commit cfb300030e
2 changed files with 12 additions and 6 deletions

View File

@ -1,21 +1,20 @@
targets=libBrowser,browser,copy,delete,desktop,desktopctl,move,open,properties,view targets=libBrowser,browser,copy,delete,desktop,desktopctl,move,open,properties,view
#cppflags=-D EMBEDDED #cppflags=-D EMBEDDED
cflags_force=-W `pkg-config --cflags libDesktop` cflags_force=-W `pkg-config --cflags libDesktop`
cflags=-Wall -g -O2 -pedantic -fstack-protector cflags=-Wall -g -O2 -pedantic -fPIC -fstack-protector
ldflags_force=`pkg-config --libs libDesktop` -lintl ldflags_force=`pkg-config --libs libDesktop` -lintl
dist=Makefile,browser.h,callbacks.h,common.c,desktop.h,desktopicon.h dist=Makefile,browser.h,callbacks.h,common.c,desktop.h,desktopicon.h
[libBrowser] [libBrowser]
type=library type=library
sources=vfs.c sources=vfs.c
cflags=-fPIC
install=$(LIBDIR) install=$(LIBDIR)
[browser] [browser]
type=binary type=binary
depends=libBrowser.a depends=libBrowser.a
sources=browser.c,callbacks.c,main.c sources=browser.c,callbacks.c,main.c
ldflags=-L . -Wl,-rpath,$(LIBDIR) -lBrowser ldflags=-L . -Wl,-rpath,$(LIBDIR) -lBrowser -Wl,-pie
install=$(BINDIR) install=$(BINDIR)
[browser.c] [browser.c]
@ -31,11 +30,13 @@ depends=browser.h
[copy] [copy]
type=binary type=binary
sources=copy.c sources=copy.c
ldflags=-Wl,-pie
install=$(BINDIR) install=$(BINDIR)
[delete] [delete]
type=binary type=binary
sources=delete.c sources=delete.c
ldflags=-Wl,-pie
install=$(BINDIR) install=$(BINDIR)
[desktop] [desktop]
@ -43,7 +44,7 @@ type=binary
depends=libBrowser.a depends=libBrowser.a
sources=desktop.c,desktopicon.c sources=desktop.c,desktopicon.c
cflags=`pkg-config --cflags x11 xrandr` cflags=`pkg-config --cflags x11 xrandr`
ldflags=`pkg-config --libs x11 xrandr` -L . -Wl,-rpath,$(LIBDIR) -lBrowser ldflags=`pkg-config --libs x11 xrandr` -L . -Wl,-rpath,$(LIBDIR) -lBrowser -Wl,-pie
install=$(BINDIR) install=$(BINDIR)
[desktop.c] [desktop.c]
@ -57,6 +58,7 @@ cppflags=-D PREFIX=\"$(PREFIX)\"
[desktopctl] [desktopctl]
type=binary type=binary
sources=desktopctl.c sources=desktopctl.c
ldflags=-Wl,-pie
install=$(BINDIR) install=$(BINDIR)
[desktopctl.c] [desktopctl.c]
@ -65,18 +67,20 @@ depends=desktop.h,../config.h
[move] [move]
type=binary type=binary
sources=move.c sources=move.c
ldflags=-Wl,-pie
install=$(BINDIR) install=$(BINDIR)
[open] [open]
type=binary type=binary
sources=open.c sources=open.c
ldflags=-Wl,-pie
install=$(BINDIR) install=$(BINDIR)
[properties] [properties]
type=binary type=binary
depends=libBrowser.a depends=libBrowser.a
sources=properties.c sources=properties.c
ldflags=-L . -Wl,-rpath,$(LIBDIR) -lBrowser ldflags=-L . -Wl,-rpath,$(LIBDIR) -lBrowser -Wl,-pie
install=$(BINDIR) install=$(BINDIR)
[properties.c] [properties.c]
@ -86,4 +90,5 @@ cppflags=-D PREFIX=\"$(PREFIX)\"
[view] [view]
type=binary type=binary
sources=view.c sources=view.c
ldflags=-Wl,-pie
install=$(BINDIR) install=$(BINDIR)

View File

@ -1,11 +1,12 @@
targets=dirtree,iconlist targets=dirtree,iconlist
cflags_force=-W `pkg-config --cflags gtk+-2.0` cflags_force=-W `pkg-config --cflags gtk+-2.0`
cflags=-Wall -g -O2 -pedantic -fstack-protector cflags=-Wall -g -O2 -pedantic -fPIC -fstack-protector
ldflags_force=`pkg-config --libs gtk+-2.0` ldflags_force=`pkg-config --libs gtk+-2.0`
#for Gtk+ 3 #for Gtk+ 3
#cflags_force=-W `pkg-config --cflags gtk+-3.0` #cflags_force=-W `pkg-config --cflags gtk+-3.0`
#cflags=-Wall -g -O2 #cflags=-Wall -g -O2
#ldflags_force=`pkg-config --libs gtk+-3.0` #ldflags_force=`pkg-config --libs gtk+-3.0`
ldflags=-Wl,-pie
dist=Makefile dist=Makefile
[dirtree] [dirtree]