Makefile (1607B)
1 # sandy - simple ncurses editor 2 # See LICENSE file for copyright and license details. 3 4 include config.mk 5 6 .POSIX: 7 .SUFFIXES: .c .o 8 9 HDR = arg.h 10 11 SRC = sandy.c 12 13 OBJ = $(SRC:.c=.o) 14 15 all: options sandy 16 17 options: 18 @echo sandy build options: 19 @echo "CFLAGS = $(CFLAGS)" 20 @echo "LDFLAGS = $(LDFLAGS)" 21 @echo "CC = $(CC)" 22 23 $(OBJ): config.h config.mk 24 25 .o: 26 @echo LD $@ 27 @$(LD) -o $@ $< $(LDFLAGS) 28 29 .c.o: 30 @echo CC $< 31 @$(CC) -c -o $@ $< $(CFLAGS) 32 33 config.h: 34 @echo creating $@ from config.def.h 35 @cp config.def.h $@ 36 37 sandy: $(OBJ) 38 @echo CC -o $@ 39 @$(CC) -o $@ $(OBJ) $(LDFLAGS) 40 41 clean: 42 @echo cleaning 43 @rm -f sandy $(OBJ) sandy-$(VERSION).tar.gz 44 45 dist: clean 46 @echo creating dist tarball 47 @mkdir -p sandy-$(VERSION) 48 @cp -R LICENSE Makefile config.mk config.def.h \ 49 README TODO sandy.1 $(HDR) $(SRC) sandy-$(VERSION) 50 @tar -cf sandy-$(VERSION).tar sandy-$(VERSION) 51 @gzip sandy-$(VERSION).tar 52 @rm -rf sandy-$(VERSION) 53 54 install: all 55 @echo installing executable file to $(DESTDIR)$(PREFIX)/bin 56 @mkdir -p $(DESTDIR)$(PREFIX)/bin 57 @cp -f sandy $(DESTDIR)$(PREFIX)/bin 58 @chmod 755 $(DESTDIR)$(PREFIX)/bin/sandy 59 @echo installing manual page to $(DESTDIR)$(MANPREFIX)/man1 60 @mkdir -p $(DESTDIR)$(MANPREFIX)/man1 61 @sed "s/VERSION/$(VERSION)/g" < sandy.1 > $(DESTDIR)$(MANPREFIX)/man1/sandy.1 62 @chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sandy.1 63 64 uninstall: 65 @echo removing executable file from $(DESTDIR)$(PREFIX)/bin 66 @rm -f $(DESTDIR)$(PREFIX)/bin/sandy 67 @echo removing manual page from $(DESTDIR)$(MANPREFIX)/man1 68 @rm -f $(DESTDIR)$(MANPREFIX)/man1/sandy.1 69 70 .PHONY: all options clean dist install uninstall