Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #
  2. # This makefile contains modifications submitted by Richard Braakman
  3. # (dark@xs4all.nl) for the shared library generation.
  4. #
  5. # By default, ftplib uses PASV. If you need it to use PORT
  6. # instead, uncomment the next line
  7. #DEFINES = -DFTPLIB_DEFMODE=FTPLIB_PORT
  8. SONAME = 4
  9. SOVERSION = $(SONAME).0
  10. TARGETS = qftp libftp.so libftp.a qftp.static
  11. OBJECTS = qftp.o ftplib.o
  12. SOURCES = qftp.c ftplib.c
  13. CFLAGS = -Wall $(DEBUG) -I. $(INCLUDES) $(DEFINES) -Wno-unused-variable -D_FILE_OFFSET_BITS=64 -D__unix__
  14. LDFLAGS = -L.
  15. DEPFLAGS =
  16. all : $(TARGETS)
  17. clean :
  18. rm -f $(OBJECTS) core *.bak
  19. rm -rf unshared
  20. clobber : clean
  21. rm -f $(TARGETS) .depend
  22. rm -f libftp.so.*
  23. install : all
  24. install qftp /usr/local/bin
  25. install -m 644 libftp.so.$(SOVERSION) /usr/local/lib
  26. install -m 644 ftplib.h /usr/local/include
  27. (cd /usr/local/lib && \
  28. ln -sf libftp.so.$(SOVERSION) libftp.so.$(SONAME) && \
  29. ln -sf libftp.so.$(SONAME) libftp.so)
  30. -(cd /usr/local/bin && \
  31. for f in ftpdir ftpget ftplist ftprm ftpsend; \
  32. do ln -s qftp $$f; done)
  33. depend :
  34. $(CC) $(CFLAGS) -M $(SOURCES) > .depend
  35. # build without -fPIC
  36. unshared/ftplib.o: ftplib.c ftplib.h
  37. test -d unshared || mkdir unshared
  38. $(CC) -c $(CFLAGS) -D_REENTRANT $< -o $@
  39. static : libftp.a qftp.static
  40. qftp.static : qftp.o libftp.a
  41. $(CC) -o $@ $< libftp.a
  42. ftplib.o: ftplib.c ftplib.h
  43. $(CC) -c $(CFLAGS) -fPIC -D_REENTRANT $< -o $@
  44. libftp.a: unshared/ftplib.o
  45. ar -rcs $@ $<
  46. libftp.so.$(SOVERSION): ftplib.o
  47. $(CC) -shared -Wl,-soname,libftp.so.$(SONAME) -lc -o $@ $<
  48. libftp.so: libftp.so.$(SOVERSION)
  49. ln -sf $< libftp.so.$(SONAME)
  50. ln -sf $< $@
  51. qftp : qftp.o libftp.so ftplib.h
  52. $(CC) $(LDFLAGS) -o $@ $< -lftp
  53. ifeq (.depend,$(wildcard .depend))
  54. include .depend
  55. endif