Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # surf - simple browser
  2. # See LICENSE file for copyright and license details.
  3. .POSIX:
  4. include config.mk
  5. SRC = surf.c
  6. WSRC = webext-surf.c
  7. OBJ = $(SRC:.c=.o)
  8. WOBJ = $(WSRC:.c=.o)
  9. WLIB = $(WSRC:.c=.so)
  10. all: options surf $(WLIB)
  11. options:
  12. @echo surf build options:
  13. @echo "CC = $(CC)"
  14. @echo "CFLAGS = $(SURFCFLAGS) $(CFLAGS)"
  15. @echo "WEBEXTCFLAGS = $(WEBEXTCFLAGS) $(CFLAGS)"
  16. @echo "LDFLAGS = $(LDFLAGS)"
  17. surf: $(OBJ)
  18. $(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
  19. $(OBJ) $(WOBJ): config.h common.h config.mk
  20. config.h:
  21. cp config.def.h $@
  22. $(OBJ): $(SRC)
  23. $(CC) $(SURFCFLAGS) $(CFLAGS) -c $(SRC)
  24. $(WLIB): $(WOBJ)
  25. $(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $? $(WEBEXTLIBS)
  26. $(WOBJ): $(WSRC)
  27. $(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WSRC)
  28. clean:
  29. rm -f surf $(OBJ)
  30. rm -f $(WLIB) $(WOBJ)
  31. distclean: clean
  32. rm -f config.h surf-$(VERSION).tar.gz
  33. dist: distclean
  34. mkdir -p surf-$(VERSION)
  35. cp -R LICENSE Makefile config.mk config.def.h README \
  36. surf-open.sh arg.h TODO.md surf.png \
  37. surf.1 common.h $(SRC) $(WSRC) surf-$(VERSION)
  38. tar -cf surf-$(VERSION).tar surf-$(VERSION)
  39. gzip surf-$(VERSION).tar
  40. rm -rf surf-$(VERSION)
  41. install: all
  42. mkdir -p $(DESTDIR)$(PREFIX)/bin
  43. cp -f surf $(DESTDIR)$(PREFIX)/bin
  44. chmod 755 $(DESTDIR)$(PREFIX)/bin/surf
  45. mkdir -p $(DESTDIR)$(LIBDIR)
  46. cp -f $(WLIB) $(DESTDIR)$(LIBDIR)
  47. for wlib in $(WLIB); do \
  48. chmod 644 $(DESTDIR)$(LIBDIR)/$$wlib; \
  49. done
  50. mkdir -p $(DESTDIR)$(MANPREFIX)/man1
  51. sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1
  52. chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1
  53. uninstall:
  54. rm -f $(DESTDIR)$(PREFIX)/bin/surf
  55. rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1
  56. for wlib in $(WLIB); do \
  57. rm -f $(DESTDIR)$(LIBDIR)/$$wlib; \
  58. done
  59. - rmdir $(DESTDIR)$(LIBDIR)
  60. .PHONY: all options distclean clean dist install uninstall