Lecture notes for CSC 173, Thurs September 28, 2002 Project 2 due Monday Homework 2 out. Quiz 2 next Thursday, beginning of class ------------------------------------------------------------------------ Unix the basics cd ., .. mkdir chmod 777 convention -- see ls -l less file redirection >, < >> >&, >>& >! remote access, X server man man -k "." files ls -a .login .cshrc .emacs stuff to put in your .cshrc set noclobber set filec set autoexpand set ignoreeof alias rm 'rm -i' alias mv 'mv -i' alias cp 'cp -i -p' alias ls 'ls -F' alias ll 'ls -l' alias cs 'cd \!* ; ls' alias up 'cd $cwd:h ; echo $cwd' alias ups 'cd $cwd:h ; ls' job control and command-line editing & jobs history ^P, ^N ^B, ^F, ^A, ^E ^H, ^D other useful commands grep rcs Read the man pages for ci, co, rcs, and rlog, in that order. Then see rcsdiff and rcsmerge if necessary. cvs read _The CVS Book_ by Karl Fogel. Open source book, online enscript psnup emacs tutorial info mode multiple buffers emacsclient tags etags, ctags M-., M-* stuff to put in your .emacs file (server-start) (resize-minibuffer-mode t) (setq inhibit-startup-message t) (setq require-final-newline t) (setq completion-auto-help nil) (add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window) gdb (read the emacs info page!) list break, watch run, cont, next where print, display whatis ptype makefile subtleties (read the emacs info page!) tabs implicit rules: .c.o, etc. $@ The target of the current rule $* The root of the target of the current rule (e.g. 'foo' if the target is 'foo.o') $^ Names of all dependencies $? Names of all dependencies that are newer than the target. (lots of others; see the info files) variables and environment variables conventions make clean make install make depend gcc -M ---------------- Makefile example # excerpted from the makefile for the CSC 254 PL/0 compiler # see /u/cs254/plzero/src/Makefile .SUFFIXES: .o .cc CC = g++ CFLAGS = -g -Wall # compile for gdb (-g); warn about everything potentially dangerous GOAL = pl0 TOOLS = /u/cs254/plzero/tools ETAGS = etags -C CFILES = scanner.cc inpbuf.cc parser.cc \ attributes.cc semantics.cc symtab.cc codegen.cc \ driver.cc mips.cc optimize.cc OBJECTS = scanner.o inpbuf.o parser.o ... HFILES = scanner.h scantab.h inpbuf.h ... OTHERSOURCES = grammar SOURCES = $(HFILES) $(CFILES) $(OTHERSOURCES) .cc.o: $(CC) -c $(CFLAGS) $*.cc # End of header $(GOAL): $(OBJECTS) $(CC) $(CFLAGS) -o $(GOAL) $(OBJECTS) -liberty # libiberty contains the GNU extended getopt functions. tokens.h: grammar $(TOOLS)/mungegrammar < grammar scantab.cc: tables $(TOOLS)/makescan > scantab.cc ... # the following entries can be used to get lists of files of various classes, # for example, to do grep foo `make sources` sources: @echo $(SOURCES) writable: @ls -lg $(SOURCES) | egrep 'w-' objects: @echo $(OBJECTS) tags: $(CFILES) $(HFILES) $(ETAGS) $(CFILES) $(HFILES) tokens.h actions.cc actions.h clean: -rm -f $(GOAL) $(OBJECTS) depend: echo '# DO NOT EDIT THIS FILE -- it is automatically generated' \ > makefile.dep echo '' >> makefile.dep $(CC) -M $(CFILES) actions.cc >> makefile.dep include makefile.dep