how to `make` the src code of APUE book

来源:互联网 发布:jquery遍历数组 编辑:程序博客网 时间:2024/05/19 15:40





Firstly, go to www.apuebook.com to get the src code package.

If you'd like to `make all` the code in a time, pls follows the Instruction 1.
If not, I also provide the alternative instruction for your customized code.

Instruction 1: `make all` code.
  1. Unpack the source package.
  2. Open <src_pkg_home>/Make.define.linux file, then set WKDIR to the pathname of the tree containing the source code.
  3. [hillmover@localhost src_pkg_home] $ vi Make.define.linux
    WORKDIR=...
  4. Open <src_pkg_home>/std/linux.mk file, then replace "nawk" with "awk".
  5. $ make
Instruction 2: compile and link your customize code.
  1. Unpack the source package.
  2. Open <src_pkg_home>/Make.define.linux file, then set WKDIR to the pathname of the tree containing the source code.
  3. Open <src_pkg_home>/Makefile, then set DIRS = lib.
  4. [hillmover@localhost src_pkg_home] $ make
  5. Now, you should find libapue.a file under the <src_pkg_home>/lib path.
  6. Customize code.
  7. For example, you can open <src_pkg_home>/file/ls1.c, then change the code as your personal requirements.
  8. Compile & Link your customized code
  9. [hillmover@localhost file] $ gcc -c -I ../include -o ls1.o ls1.c
    [hillmover@localhost file] $ gcc -o ls1 ls1.o ../lib/libapue.a
Note. APUE = Advanced Programming in the UNIX Environment.
原创粉丝点击