home *** CD-ROM | disk | FTP | other *** search
/ PC Open 48 / pcopen48.iso / Internet / HtTrack / DATA1.CAB / Sources / lib / Makefile < prev    next >
Encoding:
Makefile  |  2001-01-21  |  8.2 KB  |  251 lines

  1. # HTTrack Website Copier, Offline Browser for Windows and Unix
  2. # Copyright (C) Xavier Roche, Yann Philippot
  3. # Version: 1.02 (06/2000)
  4. # Usage: just type 'make'
  5.  
  6. ### Makefile commands
  7. MAIN      =
  8. CC        = gcc 
  9. CFLAGS    = -O -Wall -D_REENTRANT
  10. # threads
  11. LFLAGS    = -lpthread
  12.  
  13. BINARIES  = httrack.o htsback.o htscache.o\
  14.     htscatchurl.o htsfilters.o htsftp.o htshash.o\
  15.     htshelp.o htsjava.o htslib.o htsmain.o\
  16.     htsname.o htsrobots.o htstools.o htswizard.o\
  17.     htsalias.o htsthread.o\
  18.     htsbauth.o htsmd5.o\
  19.     md5.o
  20. BOUTPUT     = httrack
  21. HTSSYSTEM = htssystem.h
  22. BINPATH   = /usr/local/bin/
  23. ## Defines for "library" (program compiled with HTTrack)
  24. BINARIES_LIB = example.o httracklib.o\
  25.     src/httrack.o src/htsback.o src/htscache.o\
  26.     src/htscatchurl.o src/htsfilters.o src/htsftp.o src/htshash.o\
  27.     src/htshelp.o src/htsjava.o src/htslib.o src/htsmain.o\
  28.     src/htsname.o src/htsrobots.o src/htstools.o src/htswizard.o\
  29.     src/htsalias.o\
  30.     src/htsbauth.o src/htsmd5.o\
  31.     src/md5.o
  32. BOUTPUT_LIB = example
  33. HTSSYSTEM_LIB = src/htssystem.h
  34.  
  35. # in_addr_t problems :
  36. # In case of problems during compiling,
  37. # make htss
  38. # edit htssystem.h and add the following line:
  39. # #define HTS_DO_NOT_REDEFINE_in_addr_t 1
  40. # make manual
  41.  
  42.  
  43. # Keywords for build types (example: make linux)
  44. MAKE_LINUX   = linux
  45. MAKE_NETBSD  = netbsd
  46. MAKE_SOLARIS = solaris
  47. MAKE_AIX     = aix
  48. MAKE_STD     = standard
  49. ###
  50. MAKE_LIB     = build_httracklib
  51. ###
  52.  
  53. # First, detect OS Type
  54. # If your make does not recognize this, change it!
  55. SHORTUNAME = $(shell uname)
  56. FULLUNAME = $(shell uname -a)
  57.  
  58. ### Targets:
  59.  
  60. # Default target, attempt to use uname if necessary
  61. # if uname is empty, display info message
  62. all :
  63.     @if  [ '$(SHORTUNAME)' != '' ]; then\
  64.         $(MAKE) $(SHORTUNAME);\
  65.         else\
  66.         $(MAKE) help;\
  67.         fi
  68.  
  69. # If we can not detect the OS Type, show a message info
  70. help :
  71.     @clear
  72.     @echo ""
  73.     @echo "Welcome to HTTrack Website Copier install!"
  74.     @echo "-----------------------------------------"
  75.     @echo ""
  76.     @echo "1. To make HTTrack, just type in:"
  77.     @echo "    make $(MAKE_LINUX)"
  78.     @echo "  or"
  79.     @echo "    make $(MAKE_NETBSD)"
  80.     @echo "  or"
  81.     @echo "    make $(MAKE_SOLARIS)"
  82.     @echo "  or"
  83.     @echo "    make $(MAKE_AIX)"
  84.     @echo "  or"
  85.     @echo "    make $(MAKE_STD)"
  86.     @echo ""
  87.     @echo "According to your OS type"
  88.     @echo "(example: type in 'make $(MAKE_LINUX)' if you compile HTTrack with linux)"
  89.     @echo 
  90.     @echo "Or, if it does not work, you can try "
  91.     @echo "  make htss"
  92.     @echo "  edit htssystem.h (check OS type), and add the following line:"
  93.     @echo "    #define HTS_DO_NOT_REDEFINE_in_addr_t 1"
  94.     @echo "  make manual"
  95.     @echo 
  96.     @echo "2. Then, type in 'make install' to copy httrack to $(BINPATH)"
  97.     @echo "   or just use ./httrack to launch the program"
  98.     @echo ""
  99.     @echo "3. Build problems, type in:"
  100.     @echo "   make moreinfo"
  101.     @echo ""
  102.     @echo "Have fun with HTTrack Website Copier!"
  103.     @echo ""
  104. info : help
  105.  
  106. # Troubleshooter
  107. moreinfo :
  108.     @echo "Known problems:"
  109.     @echo ""
  110.     @echo "`in_addr_t' undeclared (first use this function)'
  111.     @echo "see in_addr_t problems in Makefile"
  112.     @echo ""
  113.  
  114. ###
  115.  
  116. ## Build Targets (this is the name given by 'uname')
  117. Linux  : $(MAKE_LINUX)
  118. SunOS  : $(MAKE_SOLARIS)
  119. AIX    : $(MAKE_AIX)
  120. NetBSD : $(MAKE_NETBSD)
  121.  
  122. ### Build Targets (standard types)
  123. default          : firstinfo htssystem htssystem_default build_default strip clean lastinfo
  124. $(MAKE_LINUX)    : firstinfo htssystem htssystem_linux   build_default strip clean lastinfo
  125. $(MAKE_SOLARIS)  : firstinfo htssystem htssystem_solaris build_solaris strip clean lastinfo
  126. $(MAKE_AIX)      : firstinfo htssystem htssystem_aix     build_default strip clean lastinfo
  127. $(MAKE_NETBSD)   : firstinfo htssystem htssystem_netbsd  build_default strip clean lastinfo
  128. $(MAKE_STD)      : firstinfo htssystem htssystem_default build_default strip clean lastinfo
  129. ### Defines for "library" (program compiled with HTTrack)
  130. $(MAKE_LIB)      : build_lib strip_lib clean_lib lastinfo
  131. ###
  132.  
  133. ## Defines for OSes
  134. lib_default   : htssystem htssystem_default addhtssystem_lib info_lib
  135. lib_linux     : htssystem htssystem_linux   addhtssystem_lib info_lib
  136. lib_solaris   : htssystem htssystem_solaris addhtssystem_lib info_lib
  137. lib_aix       : htssystem htssystem_aix     addhtssystem_lib info_lib
  138. lib_netbsd    : htssystem htssystem_netbsd  addhtssystem_lib info_lib
  139. lib_std       : htssystem htssystem_default addhtssystem_lib info_lib
  140.  
  141.  
  142. # manual build
  143. htss             : htssystem htssystem_default
  144. manual           : build_default strip clean lastinfo
  145.  
  146. # Creates htssystem.h file
  147. htssystem :
  148.     @echo "/* HTTrack, Offline Browser for Windows and Unix */"    > $(HTSSYSTEM)
  149.     @echo ""                                                      >> $(HTSSYSTEM)
  150.     @echo "/* HTTrack system definition */"                       >> $(HTSSYSTEM)
  151.     @echo "/* This should be the only file you have to change */" >> $(HTSSYSTEM)
  152.     @echo ""                                                      >> $(HTSSYSTEM)
  153.     @echo "/* Solaris: 0 / Windows: 1 / AIX: 2 / Linux: 3 */"     >> $(HTSSYSTEM)
  154.     @echo ""                                                      >> $(HTSSYSTEM)
  155.     @echo ""                                                      >> $(HTSSYSTEM)
  156.     @echo "/* Fix plateform number to 0 (SunOS) */"               >> $(HTSSYSTEM)
  157.     @echo "/* If it doesn't compile, try another one */"          >> $(HTSSYSTEM)
  158.  
  159. htssystem_solaris :
  160.     @echo "#define HTS_PLATFORM 0"                                >> $(HTSSYSTEM)
  161.     @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\""            >> $(HTSSYSTEM)
  162.     @echo "#define HTS_LITTLE_ENDIAN"                             >> $(HTSSYSTEM)
  163.     @echo ""                                                      >> $(HTSSYSTEM)
  164.  
  165. htssystem_aix :
  166.     @echo "#define HTS_PLATFORM 2"                                >> $(HTSSYSTEM)
  167.     @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\""            >> $(HTSSYSTEM)
  168.     @echo "#define HTS_LITTLE_ENDIAN"                             >> $(HTSSYSTEM)
  169.     @echo ""                                                      >> $(HTSSYSTEM)
  170.  
  171. htssystem_linux :
  172.     @echo "#define HTS_PLATFORM 3"                                >> $(HTSSYSTEM)
  173.     @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\""            >> $(HTSSYSTEM)
  174.     @echo ""                                                      >> $(HTSSYSTEM)
  175.  
  176. htssystem_netbsd:
  177.     @echo "#define HTS_PLATFORM 3"                                >> $(HTSSYSTEM)
  178.     @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\""            >> $(HTSSYSTEM)
  179.     @echo "#define HTS_DO_NOT_REDEFINE_in_addr_t"                 >> $(HTSSYSTEM)
  180.     @echo "#define HTS_DO_NOT_SIGCLD"                             >> $(HTSSYSTEM)
  181.     @echo ""                                                      >> $(HTSSYSTEM)
  182.  
  183. htssystem_default :
  184.     @echo "#define HTS_PLATFORM 3"                                >> $(HTSSYSTEM)
  185.     @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\""            >> $(HTSSYSTEM)
  186.     @echo ""                                                      >> $(HTSSYSTEM)
  187.  
  188. ## Defines for "library" (program compiled with HTTrack)
  189. addhtssystem_lib :
  190.     @echo "/* Extended functions */"                              >> $(HTSSYSTEM)
  191.     @echo "#define HTS_ANALYSTE 2"                                >> $(HTSSYSTEM)
  192.     @echo ""                                                      >> $(HTSSYSTEM)
  193.  
  194. # Info message before build
  195. firstinfo :
  196.     @echo "Building all, please wait"
  197.     @echo "In case of problems, type in:"
  198.     @echo "make help"
  199.     @echo ""
  200.     @echo "OS TYPE:   $(SHORTUNAME)"
  201.     @echo "Make mode: $(MAKECMDGOALS)"
  202.     @echo
  203.  
  204. ##
  205. info_lib : 
  206.     @echo "Please copy htssystem.h to src/htssystem.h by typing:"
  207.     @echo "cp htssystem.h src/htssystem.h"
  208.  
  209. ### Targets for compiling
  210. build_solaris : $(BINARIES)
  211.     $(CC) $(CFLAGS) $(BINARIES) -o $(BOUTPUT) $(LFLAGS) -lnsl -lsocket
  212.     chmod +x $(BOUTPUT)
  213.  
  214. build_default : $(BINARIES)
  215.     $(CC) $(CFLAGS) $(BINARIES) -o $(BOUTPUT) $(LFLAGS)
  216.     chmod +x $(BOUTPUT)
  217.  
  218. ## Defines for "library" (program compiled with HTTrack)
  219. build_lib : $(BINARIES_LIB)
  220.     $(CC) $(CFLAGS) $(BINARIES_LIB) -o $(BOUTPUT_LIB) $(LFLAGS)
  221.     chmod +x $(BOUTPUT_LIB)
  222.  
  223. ##
  224. # Strip file so that is can be shorter
  225. strip :
  226.     strip $(BOUTPUT)
  227.  
  228. strip_lib :
  229.     strip $(BOUTPUT_LIB)
  230.  
  231. # Cleaning up..
  232. clean :
  233.     rm -f $(BINARIES)
  234.  
  235. ## Defines for "library" (program compiled with HTTrack)
  236. clean_lib :
  237.     rm -f $(BINARIES_LIB)
  238.  
  239. # Bye bye
  240. lastinfo :
  241.     @echo "Build successful"
  242.  
  243. # Installing httrack into the correct folder
  244. install :
  245.     @echo "Copying $(BOUTPUT) to $(BINPATH).."
  246.     chmod a+rx $(BOUTPUT)
  247.     cp $(BOUTPUT) $(BINPATH)
  248.  
  249. ###
  250.  
  251.