Presentation is loading. Please wait.

Presentation is loading. Please wait.

Basic linux shell commands and Makefiles. Log on to engsoft.rutgers.edu Open SSH Secure Shell – Quick Connect Hostname: engsoft.rutgers.edu Username/password:

Similar presentations


Presentation on theme: "Basic linux shell commands and Makefiles. Log on to engsoft.rutgers.edu Open SSH Secure Shell – Quick Connect Hostname: engsoft.rutgers.edu Username/password:"— Presentation transcript:

1 Basic linux shell commands and Makefiles

2 Log on to engsoft.rutgers.edu Open SSH Secure Shell – Quick Connect Hostname: engsoft.rutgers.edu Username/password: same as your logon to the computer – tcsh shell by default For basic commands very similar to bash and dash (default on Ubuntu)

3 Basic linux shell commands ls – lists information about the files in the current directory – ls –l Will give more detailed information mkdir – makes a new directory cd - changes the directory rmdir – removes the directory

4 Basic linux shell commands cp – copies a file mv - moves a file, also used for renaming rm – removes a file pwd – shows the current directory chmod [option] - changes the permissions for the file pico - basic editor

5 GCC/G++ – C and C++ compilers for linux – To use run: gcc g++ – Default output filename is a.out – Can specify the output with –o parameter – To run the output:./a.out Example: g++ max_min.cpp g++ booklist.cpp main.cpp booklist.h –o booklist

6 Makefiles Make – An utility to automatically build executable programs from source code – The makefiles specify how to build the files – Looks for a file named makefile in your directory – After you create a makefile to run make Make

7 Basic Makefile Makefiles are composed of – Target: dependencies [tab] system command Example 1 all: g++ max_min.cpp –o max_min Example 2 all: g++ booklist.cpp booklist.h main.cpp –o booklist

8 Using dependencies You can specify different targets – Useful if you wish to only build certain files Example: all: program1 program1: booklist.o main.o g++ booklist.o main.o –o booklist booklist.o: booklist.cpp g++ -c booklist.cpp main.o: main.cpp g++ -c main.cpp

9 Clean option Example: clean: rm –f *o booklist Will remove all the object files and booklist from the directory. You can run it with the command: ‘make clean’

10 Using variables and comments Variables – You can declare variables in makefiles For example: ‘CC=g++’ – You can use variables For example: ‘$(VAR)’ Comments – Use # to specify the line is a comment


Download ppt "Basic linux shell commands and Makefiles. Log on to engsoft.rutgers.edu Open SSH Secure Shell – Quick Connect Hostname: engsoft.rutgers.edu Username/password:"

Similar presentations


Ads by Google