Compiling and Using UNIX

Last time: Emacs

Prof. Brian D. Davison

Computer Science & Engineering, Lehigh University

Development Process

Explain the difference between compiling and linking. What do each of these steps do?

Makefiles

Note that the tabbed lines are identical to the earlier page. TAB is essential! Often a problem when cutting and pasting. What does make/Makefile actually do? Show dependencies and rules (could be multiple rule lines). Especially useful for larger programs with even more source files. Now what would you need to do if you wanted to add debugging? Or change compiler? Or add optimization?

Better Makefiles

make supports variables so we can use them to make future changes simpler. clean helps when you want to compile from scratch (e.g., after changing flags)

Compiling under Emacs

Using UNIX

info is a subset of emacs; info info to get started; man man; man is better than Google -- specific to your OS and installation

Logging in and out

I use tcsh instead of bash because that is what I learned; again, like editors, shell choice is often a 'religious' issue.

Comparison to DOS/Windows

UNIX Commands 1

PWD=Print Working Directory CD=Change Directory

UNIX Commands 2

Be careful about rm -rf! LS=LiSt (files or contents of a directory) RM=ReMove

Viewing Files

You can always open a text file in emacs to view it. However, there are other ways -- cat, less, and more are typical choices.
less and more are called pagers -- they display a large file, one page (screenful) at a time.

C Programming

Note the man page sections for the system calls. Use man -s to specify which section of the manual pages to search.

Looking Ahead