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
#cppflags=-D EMBEDDED
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
dist=Makefile,browser.h,callbacks.h,common.c,desktop.h,desktopicon.h
[libBrowser]
type=library
sources=vfs.c
cflags=-fPIC
install=$(LIBDIR)
[browser]
type=binary
depends=libBrowser.a
sources=browser.c,callbacks.c,main.c
ldflags=-L . -Wl,-rpath,$(LIBDIR) -lBrowser
ldflags=-L . -Wl,-rpath,$(LIBDIR) -lBrowser -Wl,-pie
install=$(BINDIR)
[browser.c]
@ -31,11 +30,13 @@ depends=browser.h
[copy]
type=binary
sources=copy.c
ldflags=-Wl,-pie
install=$(BINDIR)
[delete]
type=binary
sources=delete.c
ldflags=-Wl,-pie
install=$(BINDIR)
[desktop]
@ -43,7 +44,7 @@ type=binary
depends=libBrowser.a
sources=desktop.c,desktopicon.c
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)
[desktop.c]
@ -57,6 +58,7 @@ cppflags=-D PREFIX=\"$(PREFIX)\"
[desktopctl]
type=binary
sources=desktopctl.c
ldflags=-Wl,-pie
install=$(BINDIR)
[desktopctl.c]
@ -65,18 +67,20 @@ depends=desktop.h,../config.h
[move]
type=binary
sources=move.c
ldflags=-Wl,-pie
install=$(BINDIR)
[open]
type=binary
sources=open.c
ldflags=-Wl,-pie
install=$(BINDIR)
[properties]
type=binary
depends=libBrowser.a
sources=properties.c
ldflags=-L . -Wl,-rpath,$(LIBDIR) -lBrowser
ldflags=-L . -Wl,-rpath,$(LIBDIR) -lBrowser -Wl,-pie
install=$(BINDIR)
[properties.c]
@ -86,4 +90,5 @@ cppflags=-D PREFIX=\"$(PREFIX)\"
[view]
type=binary
sources=view.c
ldflags=-Wl,-pie
install=$(BINDIR)

View File

@ -1,11 +1,12 @@
targets=dirtree,iconlist
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`
#for Gtk+ 3
#cflags_force=-W `pkg-config --cflags gtk+-3.0`
#cflags=-Wall -g -O2
#ldflags_force=`pkg-config --libs gtk+-3.0`
ldflags=-Wl,-pie
dist=Makefile
[dirtree]