home *** CD-ROM | disk | FTP | other *** search
Makefile | 2001-01-21 | 8.2 KB | 251 lines |
- # HTTrack Website Copier, Offline Browser for Windows and Unix
- # Copyright (C) Xavier Roche, Yann Philippot
- # Version: 1.02 (06/2000)
- # Usage: just type 'make'
-
- ### Makefile commands
- MAIN =
- CC = gcc
- CFLAGS = -O -Wall -D_REENTRANT
- # threads
- LFLAGS = -lpthread
-
- BINARIES = httrack.o htsback.o htscache.o\
- htscatchurl.o htsfilters.o htsftp.o htshash.o\
- htshelp.o htsjava.o htslib.o htsmain.o\
- htsname.o htsrobots.o htstools.o htswizard.o\
- htsalias.o htsthread.o\
- htsbauth.o htsmd5.o\
- md5.o
- BOUTPUT = httrack
- HTSSYSTEM = htssystem.h
- BINPATH = /usr/local/bin/
- ## Defines for "library" (program compiled with HTTrack)
- BINARIES_LIB = example.o httracklib.o\
- src/httrack.o src/htsback.o src/htscache.o\
- src/htscatchurl.o src/htsfilters.o src/htsftp.o src/htshash.o\
- src/htshelp.o src/htsjava.o src/htslib.o src/htsmain.o\
- src/htsname.o src/htsrobots.o src/htstools.o src/htswizard.o\
- src/htsalias.o\
- src/htsbauth.o src/htsmd5.o\
- src/md5.o
- BOUTPUT_LIB = example
- HTSSYSTEM_LIB = src/htssystem.h
-
- # in_addr_t problems :
- # In case of problems during compiling,
- # make htss
- # edit htssystem.h and add the following line:
- # #define HTS_DO_NOT_REDEFINE_in_addr_t 1
- # make manual
-
-
- # Keywords for build types (example: make linux)
- MAKE_LINUX = linux
- MAKE_NETBSD = netbsd
- MAKE_SOLARIS = solaris
- MAKE_AIX = aix
- MAKE_STD = standard
- ###
- MAKE_LIB = build_httracklib
- ###
-
- # First, detect OS Type
- # If your make does not recognize this, change it!
- SHORTUNAME = $(shell uname)
- FULLUNAME = $(shell uname -a)
-
- ### Targets:
-
- # Default target, attempt to use uname if necessary
- # if uname is empty, display info message
- all :
- @if [ '$(SHORTUNAME)' != '' ]; then\
- $(MAKE) $(SHORTUNAME);\
- else\
- $(MAKE) help;\
- fi
-
- # If we can not detect the OS Type, show a message info
- help :
- @clear
- @echo ""
- @echo "Welcome to HTTrack Website Copier install!"
- @echo "-----------------------------------------"
- @echo ""
- @echo "1. To make HTTrack, just type in:"
- @echo " make $(MAKE_LINUX)"
- @echo " or"
- @echo " make $(MAKE_NETBSD)"
- @echo " or"
- @echo " make $(MAKE_SOLARIS)"
- @echo " or"
- @echo " make $(MAKE_AIX)"
- @echo " or"
- @echo " make $(MAKE_STD)"
- @echo ""
- @echo "According to your OS type"
- @echo "(example: type in 'make $(MAKE_LINUX)' if you compile HTTrack with linux)"
- @echo
- @echo "Or, if it does not work, you can try "
- @echo " make htss"
- @echo " edit htssystem.h (check OS type), and add the following line:"
- @echo " #define HTS_DO_NOT_REDEFINE_in_addr_t 1"
- @echo " make manual"
- @echo
- @echo "2. Then, type in 'make install' to copy httrack to $(BINPATH)"
- @echo " or just use ./httrack to launch the program"
- @echo ""
- @echo "3. Build problems, type in:"
- @echo " make moreinfo"
- @echo ""
- @echo "Have fun with HTTrack Website Copier!"
- @echo ""
- info : help
-
- # Troubleshooter
- moreinfo :
- @echo "Known problems:"
- @echo ""
- @echo "`in_addr_t' undeclared (first use this function)'
- @echo "see in_addr_t problems in Makefile"
- @echo ""
-
- ###
-
- ## Build Targets (this is the name given by 'uname')
- Linux : $(MAKE_LINUX)
- SunOS : $(MAKE_SOLARIS)
- AIX : $(MAKE_AIX)
- NetBSD : $(MAKE_NETBSD)
-
- ### Build Targets (standard types)
- default : firstinfo htssystem htssystem_default build_default strip clean lastinfo
- $(MAKE_LINUX) : firstinfo htssystem htssystem_linux build_default strip clean lastinfo
- $(MAKE_SOLARIS) : firstinfo htssystem htssystem_solaris build_solaris strip clean lastinfo
- $(MAKE_AIX) : firstinfo htssystem htssystem_aix build_default strip clean lastinfo
- $(MAKE_NETBSD) : firstinfo htssystem htssystem_netbsd build_default strip clean lastinfo
- $(MAKE_STD) : firstinfo htssystem htssystem_default build_default strip clean lastinfo
- ### Defines for "library" (program compiled with HTTrack)
- $(MAKE_LIB) : build_lib strip_lib clean_lib lastinfo
- ###
-
- ## Defines for OSes
- lib_default : htssystem htssystem_default addhtssystem_lib info_lib
- lib_linux : htssystem htssystem_linux addhtssystem_lib info_lib
- lib_solaris : htssystem htssystem_solaris addhtssystem_lib info_lib
- lib_aix : htssystem htssystem_aix addhtssystem_lib info_lib
- lib_netbsd : htssystem htssystem_netbsd addhtssystem_lib info_lib
- lib_std : htssystem htssystem_default addhtssystem_lib info_lib
-
-
- # manual build
- htss : htssystem htssystem_default
- manual : build_default strip clean lastinfo
-
- # Creates htssystem.h file
- htssystem :
- @echo "/* HTTrack, Offline Browser for Windows and Unix */" > $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
- @echo "/* HTTrack system definition */" >> $(HTSSYSTEM)
- @echo "/* This should be the only file you have to change */" >> $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
- @echo "/* Solaris: 0 / Windows: 1 / AIX: 2 / Linux: 3 */" >> $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
- @echo "/* Fix plateform number to 0 (SunOS) */" >> $(HTSSYSTEM)
- @echo "/* If it doesn't compile, try another one */" >> $(HTSSYSTEM)
-
- htssystem_solaris :
- @echo "#define HTS_PLATFORM 0" >> $(HTSSYSTEM)
- @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\"" >> $(HTSSYSTEM)
- @echo "#define HTS_LITTLE_ENDIAN" >> $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
-
- htssystem_aix :
- @echo "#define HTS_PLATFORM 2" >> $(HTSSYSTEM)
- @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\"" >> $(HTSSYSTEM)
- @echo "#define HTS_LITTLE_ENDIAN" >> $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
-
- htssystem_linux :
- @echo "#define HTS_PLATFORM 3" >> $(HTSSYSTEM)
- @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\"" >> $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
-
- htssystem_netbsd:
- @echo "#define HTS_PLATFORM 3" >> $(HTSSYSTEM)
- @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\"" >> $(HTSSYSTEM)
- @echo "#define HTS_DO_NOT_REDEFINE_in_addr_t" >> $(HTSSYSTEM)
- @echo "#define HTS_DO_NOT_SIGCLD" >> $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
-
- htssystem_default :
- @echo "#define HTS_PLATFORM 3" >> $(HTSSYSTEM)
- @echo "#define HTS_PLATFORM_NAME \"$(FULLUNAME)\"" >> $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
-
- ## Defines for "library" (program compiled with HTTrack)
- addhtssystem_lib :
- @echo "/* Extended functions */" >> $(HTSSYSTEM)
- @echo "#define HTS_ANALYSTE 2" >> $(HTSSYSTEM)
- @echo "" >> $(HTSSYSTEM)
-
- # Info message before build
- firstinfo :
- @echo "Building all, please wait"
- @echo "In case of problems, type in:"
- @echo "make help"
- @echo ""
- @echo "OS TYPE: $(SHORTUNAME)"
- @echo "Make mode: $(MAKECMDGOALS)"
- @echo
-
- ##
- info_lib :
- @echo "Please copy htssystem.h to src/htssystem.h by typing:"
- @echo "cp htssystem.h src/htssystem.h"
-
- ### Targets for compiling
- build_solaris : $(BINARIES)
- $(CC) $(CFLAGS) $(BINARIES) -o $(BOUTPUT) $(LFLAGS) -lnsl -lsocket
- chmod +x $(BOUTPUT)
-
- build_default : $(BINARIES)
- $(CC) $(CFLAGS) $(BINARIES) -o $(BOUTPUT) $(LFLAGS)
- chmod +x $(BOUTPUT)
-
- ## Defines for "library" (program compiled with HTTrack)
- build_lib : $(BINARIES_LIB)
- $(CC) $(CFLAGS) $(BINARIES_LIB) -o $(BOUTPUT_LIB) $(LFLAGS)
- chmod +x $(BOUTPUT_LIB)
-
- ##
- # Strip file so that is can be shorter
- strip :
- strip $(BOUTPUT)
-
- strip_lib :
- strip $(BOUTPUT_LIB)
-
- # Cleaning up..
- clean :
- rm -f $(BINARIES)
-
- ## Defines for "library" (program compiled with HTTrack)
- clean_lib :
- rm -f $(BINARIES_LIB)
-
- # Bye bye
- lastinfo :
- @echo "Build successful"
-
- # Installing httrack into the correct folder
- install :
- @echo "Copying $(BOUTPUT) to $(BINPATH).."
- chmod a+rx $(BOUTPUT)
- cp $(BOUTPUT) $(BINPATH)
-
- ###
-
-