Makefile (1248B)
1 include config.mk 2 3 .POSIX: 4 .SUFFIXES: .c .o 5 6 HDR = \ 7 arg.h \ 8 config.h \ 9 nodes.h \ 10 readpassphrase.h \ 11 util.h 12 13 LIB = \ 14 eprintf.o \ 15 readpassphrase.o 16 17 SRC = \ 18 ratox.c 19 20 OBJ = $(SRC:.c=.o) $(LIB) 21 BIN = $(SRC:.c=) 22 MAN = $(SRC:.c=.1) 23 24 all: $(BIN) 25 26 $(BIN): $(OBJ) util.a 27 $(OBJ): $(HDR) config.mk 28 29 config.h: 30 @echo creating $@ from config.def.h 31 @cp config.def.h $@ 32 33 nodes.h: 34 @echo creating $@ with nodegen 35 @./nodegen >$@ 36 37 .o: 38 @echo LD $@ 39 @$(LD) -o $@ $< util.a $(LDFLAGS) $(LDLIBS) 40 41 .c.o: 42 @echo CC $< 43 @$(CC) -c -o $@ $< $(CFLAGS) 44 45 util.a: $(LIB) 46 @echo AR $@ 47 @$(AR) -r -c $@ $(LIB) 48 @ranlib $@ 49 50 install: all 51 @echo installing executable to $(DESTDIR)$(PREFIX)/bin 52 @mkdir -p $(DESTDIR)$(PREFIX)/bin 53 @cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin 54 @chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN) 55 @echo installing manual page to $(DESTDIR)$(MANPREFIX)/man1 56 @mkdir -p $(DESTDIR)$(MANPREFIX)/man1 57 @cp -f ratox.1 $(DESTDIR)$(MANPREFIX)/man1 58 59 uninstall: 60 @echo removing executable from $(DESTDIR)$(PREFIX)/bin 61 @rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) 62 @echo removing manual page from $(DESTDIR)$(MANPREFIX)/man1 63 @rm $(DESTDIR)$(MANPREFIX)/man1/ratox.1 64 65 clean: 66 @echo cleaning 67 @rm -f $(BIN) $(OBJ) $(LIB) util.a 68 69 .PHONY: all binlib bin install uninstall clean