Compiling and Installing with make install


Compiling and Installing with make install

Your final step is to get the software installed on the Unix system. With some programs, all you'll have to do is put the files in the directory where you want them to live (often ~/bin for programs or scripts or sometimes cgi-bin for scripts or programs for Web use). With others, though, you'll have to compile first and then install.

You can compile and install using make install, which reads the Makefile (to see how to set everything up) and takes care of compiling and installing for you (Code Listing 14.4). Again, be sure to read the instructions carefully before you start and follow them exactly.

Code Listing 14.4. make delivers incredible quantities of junk (but hopefully no error message) to your screen.

jdoe /home/jdoe/src/yencode-0.46 $ make cd . \    && CONFIG_FILES= CONFIG_HEADERS=config.h \       /bin/sh ./config.status config.status: creating config.h config.status: config.h is unchanged make  all-recursive make[1]: Entering directory '/home/jdoe/src/yencode-0.46' Making all in intl make[2]: Entering directory '/home/jdoe/src/yencode-0.46/intl' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/home/jdoe/src/yencode-0.46/intl' Making all in po make[2]: Entering directory '/home/jdoe/src/yencode-0.46/po'  ... gcc -DLOCALEDIR=\"/home/jdoe/share/locale\" -DSYSTYPE=\"i686-pc-linux-gnu\" -I. -I. -I..  -I../lib -I../intl   -Wall -Wno-unused -g -O2 -c 'test -f ydecode.c || echo './'`ydecode.c gcc -Wall -Wno-unused -g -O2   -o ydecode  ydecode.o crc.o file.o output.o ../lib/libmisc.a make[3]: Leaving directory '/home/jdoe/src/yencode-0.46/src' make[2]: Leaving directory '/home/jdoe/src/yencode-0.46/src' make[2]: Entering directory '/home/jdoe/src/yencode-0.46' make[2]: Leaving directory '/home/jdoe/src/yencode-0.46' make[1]: Leaving directory '/home/jdoe/src/yencode-0.46' 

To Compile and Install Using make install:

1.

make

For starters, type make at the shell prompt (in the main directory containing your program setup files) to set up all of the variables you specified in the previous section. Code Listing 14.4 shows what make displays on the screen.

If you see error messages that aren't accompanied by a reassuring "Will continue to use something else" message, you may need to return to editing the Makefile. When you make successfully, without nasty error messages, you're ready to move ahead to step 2.

Code Listing 14.5. Type make install to finish the installation process.

jdoe /home/jdoe/src/yencode-0.46 $ make install Making install in intl make[1]: Entering directory '/home/jdoe/src/yencode-0.46/intl' if test "yencode" = "gettext" \   && test '' = 'intl-compat.o'; then \   /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo  ".././mkinstalldirs ;; esac` /home/jdoe/lib /home/jdoe/include; \   /usr/bin/install -c -m 644 libintl.h /home/jdoe/include/libintl.h; \   @LIBTOOL@ mode=install \     /usr/bin/install -c -m 644 libintl.a /home/jdoe/lib/libintl.a; \ else \   : ; \ fi if test 'no' = yes; then \   /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo  ".././mkinstalldirs ;; esac` /home/jdoe/lib; \   temp=/home/jdoe/lib/t-charset.alias; \   /home/jdoe/man/ypostrc.5       Manual page describing the `~/.ypostrc' format.   ... make[2]: Leaving directory `/home/jdoe/src/yencode-0.46' make[1]: Leaving directory `/home/jdoe/src/yencode-0.46' jdoe /home/jdoe/src/yencode-0.46 $ 

2.

make install

Type make install to finish the process (see Code Listing 14.5).

3.

~/bin/yencode

Try out the new software! (Of course, replace yencode with the name of the software you installed.) (See Code Listing 14.6).

Zowie! It works!

Code Listing 14.6. It works! We didn't do anything with it, but it works.

[View full width]

jdoe /home/jdoe/bin $ ~/bin/yencode no input files Try `~/bin/yencode help' for more information. jdoe /home/jdoe/bin $ ~/bin/yencode help Usage: ~/bin/yencode [OPTION]... FILE... Usenet file encoder.      -d, debug            output extra debugging information while running      -e, extension=EXT    use EXT for file extension instead of the default      -f, force            overwrite existing files, never prompt      -l, line=LEN         output lines that are LEN bytes in length      -m, multipart=SIZE   create multipart output each containing SIZE bytes  (defaults to                                         620k if SIZE is not specified)      -o, output=DIR       create output in DIR instead of the current dir      -p, paths            maintain paths in input filenames      -q, quiet            inhibit all messages written to the standard output          sfv=NAME         create SFV checksum file for all input files          crc=NAME         create CRC checksum file for all input files          help             display this help and exit          version          output version information and exit Report bugs to bugs@yencode.org. jdoe /home/jdoe/bin $ 

4.

cd ; rm -Rf ~/src/yencode*

After you're sure that everything works right, tar and gzip the complete source tree (in case you need to reinstall). Or, if space is tight, save the Makefile and any other files you edited, and remove the rest. (If space is tight and you didn't make any substantive changes to get everything to compile, just rm it all.)

Tips

  • Be patient, and puzzle your way through if you encounter unexpected errors or if something just doesn't go right. Reading the Makefile and source code is your best bet for solving problems.

  • After a failed attempt, type make clean or make distclean to clear out the garbage before you try again.

  • Sometimes stuff just isn't worth the trouble. Compiling and installing new software can be fairly difficult, and sometimes the problems you encounter aren't easily resolved. In writing this chapter, for example, we had a great program to install but had to spend about four hours tweaking and fixing it to get it to compile. (That's about three hours and 15 minutes longer than we'd planned on.) This can happen to anyone, so don't get discouraged, but feel free to seek out help or simply find another program that does essentially the same thing; There's enough software out there that technical difficulties in one place shouldn't be any kind of serious obstacle.

  • Pay particular attention to the paths to programs and files as you're editing scripts and other setup filesa little error in a path can be hard to spot and completely prevent the new software from working.





Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net