Makefile.osx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. PREFIX = /Library/Polipo
  2. BINDIR = $(PREFIX)/bin
  3. MANDIR = $(PREFIX)/man
  4. INFODIR = $(PREFIX)/info
  5. LOCAL_ROOT = $(PREFIX)/www
  6. DISK_CACHE_ROOT = $(PREFIX)/cache
  7. CC = gcc
  8. # CDEBUGFLAGS = -Os -g -Wall -std=gnu99
  9. CDEBUGFLAGS = -Os -g -Wall
  10. FILE_DEFINES = -DLOCAL_ROOT=\"$(LOCAL_ROOT)/\" \
  11. -DDISK_CACHE_ROOT=\"$(DISK_CACHE_ROOT)/\"
  12. # You may optionally also add any of the following to DEFINES:
  13. #
  14. # -DNO_DISK_CACHE to compile out the on-disk cache and local web server;
  15. # -DNO_IPv6 to avoid using the RFC 3493 API and stick to stock
  16. # Berkeley sockets;
  17. # -DHAVE_IPv6 to force the use of the RFC 3493 API on systems other
  18. # than GNU/Linux and BSD (let me know if it works);
  19. # -DNO_FANCY_RESOLVER to compile out the asynchronous name resolution
  20. # code;
  21. # -DNO_STANDARD_RESOLVER to compile out the code that falls back to
  22. # gethostbyname/getaddrinfo when DNS requests fail;
  23. # -DNO_TUNNEL to compile out the code that handles CONNECT requests;
  24. # -DNO_SOCKS to compile out the SOCKS gateway code.
  25. # -DNO_FORBIDDEN to compile out the all of the forbidden URL code
  26. # -DNO_REDIRECTOR to compile out the Squid-style redirector code
  27. DEFINES = $(FILE_DEFINES) $(PLATFORM_DEFINES)
  28. # Uncomment the UNIVERSAL, LDFLAGS, CFLAGS lines if you want universal binaries, otherwise
  29. # you'll produce a binary only for your architecture and version of OSX
  30. # UNIVERSAL = -O -g -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
  31. # LDFLAGS = -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
  32. # CFLAGS = $(MD5INCLUDES) $(CDEBUGFLAGS) $(DEFINES) $(EXTRA_DEFINES) $(UNIVERSAL)
  33. # If you uncommented the above CFLAGS, remove this next one.
  34. CFLAGS = $(MD5INCLUDES) $(CDEBUGFLAGS) $(DEFINES) $(EXTRA_DEFINES)
  35. SRCS = util.c event.c io.c chunk.c atom.c object.c log.c diskcache.c main.c \
  36. config.c local.c http.c client.c server.c auth.c tunnel.c \
  37. http_parse.c parse_time.c dns.c forbidden.c \
  38. md5import.c md5.c ftsimport.c fts_compat.c socks.c
  39. OBJS = util.o event.o io.o chunk.o atom.o object.o log.o diskcache.o main.o \
  40. config.o local.o http.o client.o server.o auth.o tunnel.o \
  41. http_parse.o parse_time.o dns.o forbidden.o \
  42. md5import.o ftsimport.o socks.o
  43. polipo: $(OBJS)
  44. $(CC) $(CFLAGS) $(LDFLAGS) -o polipo $(OBJS) $(MD5LIBS) $(LDLIBS)
  45. ftsimport.o: ftsimport.c fts_compat.c
  46. md5import.o: md5import.c md5.c
  47. .PHONY: all install install.binary install.man
  48. all: polipo
  49. install: install.binary install.man
  50. install.binary: all
  51. mkdir -p $(TARGET)$(BINDIR)
  52. mkdir -p $(TARGET)$(LOCAL_ROOT)
  53. mkdir -p $(TARGET)$(LOCAL_ROOT)/doc
  54. mkdir -p $(TARGET)$(DISK_CACHE_ROOT)
  55. cp -f polipo $(TARGET)$(BINDIR)/
  56. cp -f localindex.html $(TARGET)$(LOCAL_ROOT)/index.html
  57. cp -f config.osx $(TARGET)$(LOCAL_ROOT)/config
  58. texi2html polipo.texi && cp -f polipo.html $(TARGET)$(LOCAL_ROOT)/doc/index.html
  59. groff polipo.man -T ps -m man | pstopdf -i -o $(TARGET)/polipo.pdf
  60. mkdir -p /Library/StartupItems/Polipo
  61. cp -f contrib/Polipo /Library/StartupItems/Polipo/
  62. cp -f contrib/StartupParameters.plist /Library/StartupItems/Polipo/
  63. echo "POLIPO=-YES-" >> /etc/hostconfig
  64. install.man: all
  65. mkdir -p $(TARGET)$(MANDIR)/man1
  66. cp -f polipo.man $(TARGET)$(MANDIR)/man1/polipo.1
  67. TAGS: $(SRCS)
  68. etags $(SRCS)
  69. .PHONY: clean
  70. clean:
  71. -rm -f polipo *.o *~ core TAGS gmon.out
  72. -rm -f polipo.cp polipo.fn polipo.log polipo.vr
  73. -rm -f polipo.cps polipo.info* polipo.pg polipo.toc polipo.vrs
  74. -rm -f polipo.aux polipo.dvi polipo.ky polipo.ps polipo.tp
  75. -rm -f polipo.dvi polipo.ps polipo.ps.gz polipo.pdf polipo.html
  76. -rm -rf ./html/
  77. -rm -f polipo.man.html
  78. .PHONY: uninstall
  79. uninstall:
  80. rm -rf /Library/Polipo
  81. rm -rf /Library/StartupItems/Polipo
  82. cp -f /etc/hostconfig /etc/hostconfig.polipo.saved
  83. cat /etc/hostconfig.polipo.saved | grep -v POLIPO > /etc/hostconfig