Makefile.osx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. UNIVERSAL = -O -g -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
  29. LDFLAGS = -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
  30. CFLAGS = $(MD5INCLUDES) $(CDEBUGFLAGS) $(DEFINES) $(EXTRA_DEFINES) $(UNIVERSAL)
  31. SRCS = util.c event.c io.c chunk.c atom.c object.c log.c diskcache.c main.c \
  32. config.c local.c http.c client.c server.c auth.c tunnel.c \
  33. http_parse.c parse_time.c dns.c forbidden.c \
  34. md5import.c md5.c ftsimport.c fts_compat.c socks.c
  35. OBJS = util.o event.o io.o chunk.o atom.o object.o log.o diskcache.o main.o \
  36. config.o local.o http.o client.o server.o auth.o tunnel.o \
  37. http_parse.o parse_time.o dns.o forbidden.o \
  38. md5import.o ftsimport.o socks.o
  39. polipo: $(OBJS)
  40. $(CC) $(CFLAGS) $(LDFLAGS) -o polipo $(OBJS) $(MD5LIBS) $(LDLIBS)
  41. ftsimport.o: ftsimport.c fts_compat.c
  42. md5import.o: md5import.c md5.c
  43. .PHONY: all install install.binary install.man
  44. all: polipo
  45. install: install.binary install.man
  46. install.binary: all
  47. mkdir -p $(TARGET)$(BINDIR)
  48. mkdir -p $(TARGET)$(LOCAL_ROOT)
  49. mkdir -p $(TARGET)$(LOCAL_ROOT)/doc
  50. mkdir -p $(TARGET)$(DISK_CACHE_ROOT)
  51. cp -f polipo $(TARGET)$(BINDIR)/
  52. cp -f localindex.html $(TARGET)$(LOCAL_ROOT)/index.html
  53. cp -f config.osx $(TARGET)$(LOCAL_ROOT)/config
  54. texi2html polipo.texi && cp -f polipo.html $(TARGET)$(LOCAL_ROOT)/doc/index.html
  55. groff polipo.man -T ps -m man | pstopdf -i -o $(TARGET)/polipo.pdf
  56. mkdir -p /Library/StartupItems/Polipo
  57. cp -f contrib/Polipo /Library/StartupItems/Polipo/
  58. cp -f contrib/StartupParameters.plist /Library/StartupItems/Polipo/
  59. echo "POLIPO=-YES-" >> /etc/hostconfig
  60. install.man: all
  61. mkdir -p $(TARGET)$(MANDIR)/man1
  62. cp -f polipo.man $(TARGET)$(MANDIR)/man1/polipo.1
  63. TAGS: $(SRCS)
  64. etags $(SRCS)
  65. .PHONY: clean
  66. clean:
  67. -rm -f polipo *.o *~ core TAGS gmon.out
  68. -rm -f polipo.cp polipo.fn polipo.log polipo.vr
  69. -rm -f polipo.cps polipo.info* polipo.pg polipo.toc polipo.vrs
  70. -rm -f polipo.aux polipo.dvi polipo.ky polipo.ps polipo.tp
  71. -rm -f polipo.dvi polipo.ps polipo.ps.gz polipo.pdf polipo.html
  72. -rm -rf ./html/
  73. -rm -f polipo.man.html
  74. .PHONY: uninstall
  75. uninstall:
  76. rm -rf /Library/Polipo
  77. rm -rf /Library/StartupItems/Polipo
  78. cp -f /etc/hostconfig /etc/hostconfig.polipo.saved
  79. cat /etc/hostconfig.polipo.saved | grep -v POLIPO > /etc/hostconfig