dtms
diff Makefile @ 4:db4bb4b5905a
security fixes:
- refuse to run as root
- drop privileges without an explicit -u argument when running setuid-root
fixed argument parsing
fixed mem leak
added install and uninstall rules (Makefile)
author | Eleni Maria Stea <eleni@mutantstargoat.com> |
---|---|
date | Sun, 15 May 2016 00:15:45 +0300 |
parents | 50af08b83a1f |
children |
line diff
1.1 --- a/Makefile Fri May 13 23:02:26 2016 +0300 1.2 +++ b/Makefile Sun May 15 00:15:45 2016 +0300 1.3 @@ -1,3 +1,6 @@ 1.4 +# change the following line to install to a different prefix 1.5 +PREFIX = /usr/local 1.6 + 1.7 src = $(wildcard src/*.c) 1.8 obj = $(src:.c=.o) 1.9 dep = $(obj:.o=.d) 1.10 @@ -6,10 +9,7 @@ 1.11 dbg = -g 1.12 opt = -O0 1.13 1.14 -CC = gcc 1.15 -INCLUDE = -I/usr/include 1.16 -CFLAGS = -pedantic -Wall -std=c99 -D_XOPEN_SOURCE=600 $(dbg) $(INCLUDE) 1.17 -LDFLAGS = -L/usr/lib $(libs) 1.18 +CFLAGS = -pedantic -Wall -std=gnu99 -DPREFIX=\"$(PREFIX)\" $(dbg) 1.19 1.20 $(bin): $(obj) 1.21 $(CC) -o $@ $(obj) $(LDFLAGS) 1.22 @@ -22,3 +22,19 @@ 1.23 .PHONY: clean 1.24 clean: 1.25 rm -f $(obj) $(bin) $(dep) 1.26 + 1.27 +.PHONY: install 1.28 +install: $(bin) 1.29 + mkdir -p $(PREFIX)/bin $(PREFIX)/share/dtms 1.30 + cp $(bin) $(PREFIX)/bin/$(bin) 1.31 + chown root $(PREFIX)/bin/$(bin) 1.32 + chmod +s $(PREFIX)/bin/$(bin) 1.33 + cp data/dtms.mp3 $(PREFIX)/share/dtms/dtms.mp3 1.34 + 1.35 +.PHONY: uninstall 1.36 +uninstall: 1.37 + rm -f $(PREFIX)/bin/$(bin) 1.38 + rm -f $(PREFIX)/share/dtms/dtms.mp3 1.39 + rmdir $(PREFIX)/share/dtms 1.40 + 1.41 +