Makefile 826 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .SUFFIXES: .o .c .h
  2. .PHONY: all clean install uninstall
  3. CFLAGS=-std=c89 -O -Wall
  4. CC=cc
  5. INSTALL=install
  6. PROG=ed
  7. ALT=e
  8. INSTALLD=/usr/local
  9. MANPAGE=\
  10. doc/ed.1
  11. HDRS=\
  12. utf.h \
  13. utfio.h
  14. MODULES=\
  15. utf \
  16. utfio \
  17. ed
  18. OBJS=$(MODULES:=.o)
  19. .c.o:
  20. $(CC) -c $(CFLAGS) $<
  21. all: $(PROG)
  22. $(PROG): $(OBJS) $(HDRS)
  23. $(CC) $(LDFLAGS) -o $(PROG) $(OBJS)
  24. clean:
  25. rm -f *.o $(PROG)
  26. install: all $(MANPAGE)
  27. $(INSTALL) -d $(INSTALLD)/bin
  28. $(INSTALL) -d $(INSTALLD)/share/man/man1
  29. $(INSTALL) -s $(PROG) $(INSTALLD)/bin/
  30. $(INSTALL) -s $(PROG) $(INSTALLD)/bin/$(ALT)
  31. $(INSTALL) $(MANPAGE) $(INSTALLD)/share/man/man1/
  32. $(INSTALL) $(MANPAGE) $(INSTALLD)/share/man/man1/$(ALT).1
  33. uninstall:
  34. rm -f $(INSTALLD)/bin/ed
  35. rm -f $(INSTALLD)/bin/$(ALT)
  36. rm -f $(INSTALLD)/share/man/man1/ed.1
  37. rm -f $(INSTALLD)/share/man/man1/$(ALT).1