dterm-nuc

diff Makefile @ 1:5a80b73208dd

improved makefile
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 07 Apr 2017 23:54:55 +0300
parents ad098a33fd34
children
line diff
     1.1 --- a/Makefile	Fri Apr 07 23:43:06 2017 +0300
     1.2 +++ b/Makefile	Fri Apr 07 23:54:55 2017 +0300
     1.3 @@ -1,18 +1,30 @@
     1.4 -COPT		= -O3 -Wall -Werror
     1.5 -BIN		= /usr/local/bin
     1.6 -VERSION		= 0.3
     1.7 +PREFIX = /usr/local
     1.8 +VERSION = 0.4
     1.9  
    1.10 -dterm:		dterm.c
    1.11 -		gcc ${COPT} -o dterm dterm.c -DVERSION='"$(VERSION)"'
    1.12 +obj = dterm.o
    1.13 +bin = dterm
    1.14  
    1.15 -install:
    1.16 -		install dterm ${BIN}
    1.17 +CFLAGS = -pedantic -Wall -Werror -Os -DVERSION='"$(VERSION)"'
    1.18  
    1.19 +$(bin): $(obj)
    1.20 +	$(CC) -o $@ $(obj) $(LDFLAGS)
    1.21 +
    1.22 +.PHONY: install
    1.23 +install: $(bin)
    1.24 +	mkdir -p $(DESTDIR)$(PREFIX)/bin
    1.25 +	cp $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin)
    1.26 +
    1.27 +.PHONY: uninstall
    1.28 +uninstall:
    1.29 +	rm -f $(DESTDIR)$(PREFIX)/bin/$(bin)
    1.30 +
    1.31 +.PHONY: clean
    1.32  clean:
    1.33 -		rm -f dterm *.o *.bak
    1.34 +	rm -f $(bin) $(obj)
    1.35  
    1.36 -package:	dterm.c LICENCE.txt README.txt Makefile
    1.37 -		mkdir -p dterm-$(VERSION)
    1.38 -		cp dterm.c LICENCE.txt README.txt Makefile dterm-$(VERSION)
    1.39 -		tar cfvz dterm-$(VERSION).tgz dterm-$(VERSION)
    1.40 -		rm -rf dterm-$(VERSION)
    1.41 +.PHONY: package
    1.42 +package: dterm.c LICENCE.txt README.txt Makefile
    1.43 +	mkdir -p dterm-$(VERSION)
    1.44 +	cp dterm.c LICENCE.txt README.txt Makefile dterm-$(VERSION)
    1.45 +	tar czvf dterm-$(VERSION).tar.gz dterm-$(VERSION)
    1.46 +	rm -rf dterm-$(VERSION)