cpts 360 system programming unit 3 development tools
play

CptS 360 (System Programming) Unit 3: Development Tools Bob Lewis - PowerPoint PPT Presentation

Unit 3: Development Tools CptS 360 (System Programming) Unit 3: Development Tools Bob Lewis School of Engineering and Applied Sciences Washington State University Spring, 2020 Bob Lewis WSU CptS 360 (Spring, 2020) Unit 3: Development Tools


  1. Unit 3: Development Tools CptS 360 (System Programming) Unit 3: Development Tools Bob Lewis School of Engineering and Applied Sciences Washington State University Spring, 2020 Bob Lewis WSU CptS 360 (Spring, 2020)

  2. Unit 3: Development Tools Motivation ◮ Using UNIX-style development tools lets you port your code to more platforms. ◮ Most of these tools are console based: GUIs aren’t very useful when editing over ssh(1) (say). ◮ It is not couth to write system programs with an IDE. Bob Lewis WSU CptS 360 (Spring, 2020)

  3. Unit 3: Development Tools Reference ◮ Stevens & Rago, Ch. 3 aside: You can find find all code from the book in /cslab/lib/courses/cpts360/stevens_rago_apue Bob Lewis WSU CptS 360 (Spring, 2020)

  4. Unit 3: Development Tools Getting Help Several approached to getting help: ◮ man pages ◮ info(1) ◮ grep(1) ◮ /usr/share/doc ◮ /usr/include ◮ google.com (of course) Bob Lewis WSU CptS 360 (Spring, 2020)

  5. Unit 3: Development Tools man(1) pages Traditional UNIX manual page sections are: section contains 1 commands 2 system calls (most POSIX API pages) 3 general-purpose libraries (e.g. math , stdio , dbm ) 4 devices 5 file formats 6 games 7 conventions and miscellany 8 system administration To get help on these classifications, use “ $ man n intro ”. Bob Lewis WSU CptS 360 (Spring, 2020)

  6. Unit 3: Development Tools man Command Invocations ◮ $ man n entry gets information on entry , optionally restricting the search to section n ◮ $ whatis entry gets a one-line description of entry ◮ $ apropos keyword (or $ man -k keyword ) gets one-line description of one or more pages whose description includes keyword ◮ man: entry or man: entry ( section ) in browser (Firefox, at least) Bob Lewis WSU CptS 360 (Spring, 2020)

  7. Unit 3: Development Tools info ◮ emacs -like hypertext help browser. ◮ part of GNU ◮ Run “ $ info ” by itself to start at the top level with a list of (all) commands. ◮ Run “ $ info command ” for information on command . ◮ especially useful for compilers and make Bob Lewis WSU CptS 360 (Spring, 2020)

  8. Unit 3: Development Tools Installing Documentation On Linux systems, if you want documentation on foo , look for the package foo-doc . Bob Lewis WSU CptS 360 (Spring, 2020)

  9. Unit 3: Development Tools grep I’m not kidding, grep(1) is a very useful tool, if you know what to grep for... Use $ grep pat /usr/include/*.h $ grep pat /usr/include/*/*.h to find a #define or function prototype. Use $ zgrep -l pat /usr/share/man/man n /*.gz to find some remembered phrase or keyword in a man page you may have seen before. Other help source: /usr/share/doc/* Bob Lewis WSU CptS 360 (Spring, 2020)

  10. Unit 3: Development Tools make(1) ◮ We’ll touch on the basics. ◮ Good for more than just compiling. ◮ It helps to draw a dependency diagram. Bob Lewis WSU CptS 360 (Spring, 2020)

  11. Unit 3: Development Tools Makefile Syntax ◮ Comments ◮ Begin with “ # ” to end-of-line. ◮ Targets ◮ May be real files or nonexistent goals (e.g. clean ). ◮ Rules ◮ Need to use Tab . ◮ Each line is distinct shell command, unless you use “ ;\ ”. ◮ Suffix rules: ◮ may be built-in or user-defined Bob Lewis WSU CptS 360 (Spring, 2020)

  12. Unit 3: Development Tools make Macros ◮ syntax: name = value ◮ environment variables imported by default ◮ various macro tricks: ◮ old-style substitution: OBJS=$(SRCS:.c=.o) ◮ nested macros: CFLAGS=$(CFLAGS_$(ARCH)) ◮ remember: D-R-Y Bob Lewis WSU CptS 360 (Spring, 2020)

  13. Unit 3: Development Tools Commonly-used Macros Most systems have these automatically defined: the C compiler CC C compiler options CFLAGS the C++ compiler CPP CPPFLAGS C++ compiler options the loader (usually = $(CC) ) LD LDFLAGS loader options make itself, with arguments MAKE These can be overridden on the command line. Bob Lewis WSU CptS 360 (Spring, 2020)

  14. Unit 3: Development Tools make Command Line Options -k keep going as long as possible -n echo the required operations -f filename use an alternate to makefile or Makefile . -j [# of jobs] (try this on a multiprocessor system!) Bob Lewis WSU CptS 360 (Spring, 2020)

  15. Unit 3: Development Tools Commonly-Used Targets ◮ default (first target) ◮ install ◮ clean ◮ immaculate Bob Lewis WSU CptS 360 (Spring, 2020)

  16. Unit 3: Development Tools makedepend(1) ◮ analyzes source files to create dependencies of its own. ◮ handles nested includes ◮ appends dependencies to the makefile (e.g. Makefile ) ◮ “transitive closure on #include ” Bob Lewis WSU CptS 360 (Spring, 2020)

  17. Unit 3: Development Tools tar(1) ◮ syntax $ tar [ options ] file ... ◮ where options are ◮ -c create new archive (a.k.a. “tarball”) ◮ -v be verbose ◮ -f filename use filename for new or old tarball name ◮ -x extract output ◮ -z compress/uncompress tarball with gzip(1) / gunzip(1) ◮ -t list the contents of a tarball Bob Lewis WSU CptS 360 (Spring, 2020)

  18. Unit 3: Development Tools Older Revisioning Systems ◮ SCCS (Source Code Control System) (obs.) ◮ CVS (Concurrent Version System) ◮ for multiple developers ◮ was superseded by... ◮ RCS (Revision Control System) ◮ now mostly superseded by... Bob Lewis WSU CptS 360 (Spring, 2020)

  19. Unit 3: Development Tools Contemporary Revisioning Systems ◮ SVN (Subversion) ◮ manages whole directory trees of files ◮ uses database for central repository ◮ allows easy renaming of files and directories ◮ Git ◮ devised by Linus Torvalds for the Linux kernel (he formerly used BitKeeper ) ◮ project ↔ repository ◮ repositories often hosted on GitHub ( https://www.github.com ) ◮ each user gets their own copy of the whole repository ◮ see https://xkcd.com/1296 and https://xkcd.com/1597 ◮ Mercurial ◮ don’t know much about this one (see man pages) Bob Lewis WSU CptS 360 (Spring, 2020)

  20. Unit 3: Development Tools And Then There’s... ◮ The C Preprocessor: #if 1 // experimental code #else // code that you’re replacing, but want to keep around #endif ◮ The new Script (q.v.) Bob Lewis WSU CptS 360 (Spring, 2020)

  21. Unit 3: Development Tools Document Processing System programmers produce documentation. Popular choices: ◮ nroff(1) , groff(1) , and ◮ LaTeX troff(1) ◮ a pain to learn, but... ◮ easy to figure out ◮ worth the effort, esp. for ◮ outdated for regular professional publications ◮ best book (IMHO): documents, but... ◮ still used for man pages Kopka & Daley’s Guide to LaTeX ◮ Microsoft Word ◮ ReST (ReStructured Text) ◮ if you absolutely must ◮ intuitive ◮ OpenOffice ◮ uses readable ASCII files ◮ WYSIWYG, mostly ◮ generates HTML, LaTeX, ◮ OpenDoc format XML, slides from the ( .od[bgmpst] ) easy to same input analyze (zipped XML ◮ can insert LaTeX if archive) and generate needed Bob Lewis WSU CptS 360 (Spring, 2020)

  22. Unit 3: Development Tools Text Editors System programmers should know at Or maybe least one of these UNIX editors: ◮ jed(1) or jove(1) ◮ emacs(1) ◮ low-overhead ◮ “East Coast” (MIT) origin versions of ◮ also a development environment emacs(1) ◮ console mode only ◮ programmable in Lisp ◮ windowed or console ◮ gedit(1) (“ emacs -nw ”) mode ◮ Linux (Gnome) ◮ vim(1) only ◮ GUI mode only ◮ “West Coast” (UCB) origin (as vi ) ◮ most widely-used by system programmers ◮ programmable in Python ◮ console mode only Bob Lewis WSU CptS 360 (Spring, 2020)

  23. Unit 3: Development Tools IDEs: Integrated Development Environments If you really need one: ◮ Eclipse ◮ runs just about ◮ Qt Creator everywhere ◮ C++ only ◮ runs just about ◮ Visual Studio everywhere ◮ runs just about ◮ uses Qt4 GUI framework everywhere (with Qt Designer) ◮ kdevelop(1) ◮ Code::Blocks ◮ Linux (KDE) only ◮ runs just about ◮ kate(1) everywhere ◮ Linux only ◮ uses wxWidgets GUI ◮ XCode framework ◮ MacOS only Most of these support multiple languages/file formats. Any others you’d like to plug? Bob Lewis WSU CptS 360 (Spring, 2020)

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend