dtms
annotate 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 |
rev | line source |
---|---|
eleni@4 | 1 # change the following line to install to a different prefix |
eleni@4 | 2 PREFIX = /usr/local |
eleni@4 | 3 |
eleni@0 | 4 src = $(wildcard src/*.c) |
eleni@0 | 5 obj = $(src:.c=.o) |
eleni@0 | 6 dep = $(obj:.o=.d) |
eleni@0 | 7 bin = dtms |
eleni@0 | 8 |
eleni@0 | 9 dbg = -g |
eleni@0 | 10 opt = -O0 |
eleni@0 | 11 |
eleni@4 | 12 CFLAGS = -pedantic -Wall -std=gnu99 -DPREFIX=\"$(PREFIX)\" $(dbg) |
eleni@0 | 13 |
eleni@0 | 14 $(bin): $(obj) |
eleni@0 | 15 $(CC) -o $@ $(obj) $(LDFLAGS) |
eleni@0 | 16 |
eleni@0 | 17 -include $(dep) |
eleni@0 | 18 |
eleni@0 | 19 %.d: %.c |
eleni@0 | 20 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
eleni@0 | 21 |
eleni@0 | 22 .PHONY: clean |
eleni@0 | 23 clean: |
eleni@0 | 24 rm -f $(obj) $(bin) $(dep) |
eleni@4 | 25 |
eleni@4 | 26 .PHONY: install |
eleni@4 | 27 install: $(bin) |
eleni@4 | 28 mkdir -p $(PREFIX)/bin $(PREFIX)/share/dtms |
eleni@4 | 29 cp $(bin) $(PREFIX)/bin/$(bin) |
eleni@4 | 30 chown root $(PREFIX)/bin/$(bin) |
eleni@4 | 31 chmod +s $(PREFIX)/bin/$(bin) |
eleni@4 | 32 cp data/dtms.mp3 $(PREFIX)/share/dtms/dtms.mp3 |
eleni@4 | 33 |
eleni@4 | 34 .PHONY: uninstall |
eleni@4 | 35 uninstall: |
eleni@4 | 36 rm -f $(PREFIX)/bin/$(bin) |
eleni@4 | 37 rm -f $(PREFIX)/share/dtms/dtms.mp3 |
eleni@4 | 38 rmdir $(PREFIX)/share/dtms |
eleni@4 | 39 |
eleni@4 | 40 |