Makefile 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. TARGET = proxy2ch
  2. SOURCES = main.cpp BBS2chProxyConnection.cpp BBS2chProxyAuth.cpp DataStorage.cpp hmac.c stringEncodingConverter.c BBS2chProxyRawSocket.cpp BBS2chProxySecureSocket.cpp BBS2chProxyHttpHeaders.cpp BBS2chProxyURL.cpp
  3. OBJS = $(SOURCES:.cpp=.o)
  4. OBJS := $(OBJS:.c=.o)
  5. CFLAGS = -O2
  6. LDFLAGS = -lcurl -lpthread
  7. UNAME := $(shell uname)
  8. HAVE_GNUTLS := $(shell pkg-config --libs gnutls >/dev/null 2>&1; echo $$?)
  9. NOT_GLIBC := $(shell $(CC) -E -dM stringEncodingConverter.c | grep __GNU_LIBRARY__; echo $$?)
  10. ifneq ($(UNAME), Darwin)
  11. ifeq ($(NOT_GLIBC), 1)
  12. LDFLAGS += -liconv
  13. endif
  14. ifeq ($(HAVE_GNUTLS), 0)
  15. CFLAGS += -DUSE_GNUTLS
  16. LDFLAGS += -lgnutls
  17. else
  18. LDFLAGS += -lcrypto
  19. endif
  20. else
  21. LDFLAGS += -framework CoreFoundation
  22. endif
  23. .PHONY: all
  24. all : $(TARGET)
  25. $(TARGET) : $(OBJS)
  26. $(CXX) $^ -o $(TARGET) $(LDFLAGS)
  27. .cpp.o:
  28. $(CXX) $(CFLAGS) -c $<
  29. .c.o:
  30. $(CC) $(CFLAGS) -c $<
  31. .PHONY: depend
  32. depend:
  33. $(CXX) -MM $(CFLAGS) $(SOURCES) > dependencies
  34. .PHONY: clean
  35. clean :
  36. rm -f $(OBJS) $(TARGET)
  37. include dependencies