Makefile (1965B)
1 # See LICENSE file for copyright and license details. 2 3 include config.mk 4 5 ifeq ($(DEBUG), 1) 6 CFLAGS += -O0 -g -DDEBUG 7 LDFLAGS += -g 8 else 9 CFLAGS += -O3 10 endif 11 12 EXE = tim 13 SRC = $(wildcard *.c) 14 OBJ = $(SRC:.c=.o) 15 16 all: options $(EXE) 17 18 options: 19 @echo $(EXE) build options: 20 @echo "CFLAGS = $(CFLAGS)" 21 @echo "LDFLAGS = $(LDFLAGS)" 22 23 .o: 24 @echo $(LD) $@ 25 @$(LD) -o $@ $< $(LDFLAGS) 26 27 .c.o: 28 @echo $(CC) $< 29 @$(CC) -c -o $@ $< $(CFLAGS) 30 31 ${OBJ}: config.h config.mk 32 33 config.h: 34 @echo creating $@ from config.def.h 35 @cp config.def.h $@ 36 37 $(EXE): $(OBJ) 38 @echo $(CC) -o $@ 39 @$(CC) -o $@ $(OBJ) $(LDFLAGS) 40 41 clean: 42 @echo -n cleaning ... 43 @rm -f $(OBJ) $(EXE) 44 @echo \ done 45 46 install: all 47 @echo -n installing executable file to $(DESTDIR)$(PREFIX)/bin ... 48 @mkdir -p $(DESTDIR)$(PREFIX)/bin 49 @cp -f $(EXE) $(DESTDIR)$(PREFIX)/bin 50 @chmod 755 $(DESTDIR)$(PREFIX)/bin/$(EXE) 51 @echo \ done 52 @echo -n installing support files to $(DESTDIR)$(SHAREPREFIX)/$(EXE) ... 53 @mkdir -p $(DESTDIR)$(SHAREPREFIX)/$(EXE) 54 @cp -rf data plugins $(DESTDIR)$(SHAREPREFIX)/$(EXE) 55 @echo \ done 56 @echo -n installing manual page to $(DESTDIR)$(MANPREFIX)/man1 ... 57 @mkdir -p $(DESTDIR)$(MANPREFIX)/man1 58 @sed "s/VERSION/$(VERSION)/g" < $(EXE).1 > $(DESTDIR)$(MANPREFIX)/man1/$(EXE).1 59 @chmod 644 $(DESTDIR)$(MANPREFIX)/man1/$(EXE).1 60 @echo \ done 61 62 uninstall: 63 @echo -n removing executable file from $(DESTDIR)$(PREFIX)/bin ... 64 @rm -f $(DESTDIR)$(PREFIX)/bin/$(EXE) 65 @echo \ done 66 @echo -n removing support files from $(DESTDIR)$(SHAREPREFIX)/$(EXE) ... 67 @rm -rf $(DESTDIR)$(SHAREPREFIX)/$(EXE) 68 @echo \ done 69 @echo -n removing manual page from $(DESTDIR)$(MANPREFIX)/man1 ... 70 @rm -f $(DESTDIR)$(MANPREFIX)/man1/$(EXE).1 71 @echo \ done 72 73 update-man: 74 @echo -n updating man page $(EXE).1 ... 75 @cat README.md | sed "s/# $(EXE)/# $(EXE) 1\n\n##NAME\n\n$(EXE) /" | \ 76 md2man-roff | sed "s/\\[la\]/\</" | sed "s/\\[ra\]/\>/" > $(EXE).1 77 @echo \ done 78 79 .PHONY: all options clean install uninstall update-man