1 Linux Command. Advanced Compiler Laboratory2 Simple linux cmds ls List information about FILEs, by default the current directory. pwd Print Working.

Slides:



Advertisements
Similar presentations
Make. A simple make file $ make program Strength of make is its sensitivity to dependency hierarchies. Specify such dependencies in a description file.
Advertisements

Separate compilation Large programs are generally separated into multiple files, e.g. tuples.h, ray.h, ray.c, tuples.c main.c With several files, we can.
Makefiles  Provide a way for separate compilation.  Describe the dependencies among the project files.  The make utility.
The Makefile utility ABC – Chapter 11, Motivation Small programs single file “Not so small” programs : –Many lines of code –Multiple components.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
Basic linux shell commands and Makefiles. Log on to engsoft.rutgers.edu Open SSH Secure Shell – Quick Connect Hostname: engsoft.rutgers.edu Username/password:
Linux Files. Files and directories As in Windows directories are structures which contain –Other directories –Files.
1 Basics of Linux On linux machine: Login at your home directory Open a “shell” or “terminal” or “xterm” workspace (4) On windows machine Intall linux.
The Makefile Utility ABC – Chapter 11, Motivation Small programs single file “Not so small” programs : –Many lines of code –Multiple components.
Embedded Programming and Robotics Lesson 13 Basic Linux 1.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
A Mini UNIX Tutorial. What’s UNIX?  An operating system run on many servers/workstations  Invented by AT&T Bell Labs in late 60’s  Currently there.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Learning basic Unix command IT 325 operating system.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
V Avon High School Tech Crew Agenda Old Business –Delete Files New Business –Week 9 Topics: Coming up: –Yearbook Picture: Feb 7 12:20PM.
Working with Files Chapter 5. Display a Calendar Display a calendar for a specific month – cal Display a calendar for a specific year – cal 2000.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Unix Makefiles COP 3330 Lecture Notes Dr. David A. Gaitros.
Linux+ Guide to Linux Certification, Second Edition
The UNIX development environment CS 400/600 – Data Structures.
Adv. UNIX: large/131 Advanced UNIX v Objectives of these slides: –learn how to write/manage large programs consisting of multiple files, which.
Lecture 2 Linux Basic Commands,Shell and Make September 8, 2015 Kyu Ho Park.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
System Programming - LAB 1 Programming Environments.
Makefile M.A Doman. Compiling multiple objects Card.cpp -> Card.o Deck.cpp -> Deck.o main.cpp -> main.o main.o Deck.o Card.o -> Dealer.exe.
Introduction to UNIX Road Map: 1. UNIX Structure 2. Components of UNIX 3. Process Structure 4. Shell & Utility Programs 5. Using Files & Directories 6.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Makefiles. Multiple Source Files (1) u Obviously, large programs are not going to be contained within single files. u C provides several techniques to.
Chapter 2. UNP configuration, MAKEFILE, Echo program 백 일 우
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Basic of UNIX For fresh members of SPARCS
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
EGEE-III INFSO-RI Enabling Grids for E-sciencE Apr. 25, Grid Computing Hands On Training for Users Faculty of Sciences, University.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Makefiles CARYL RAHN. Separate compilation Large programs are generally separated into multiple files, e.g. main.c addmoney.c removemoney.c money.h With.
Lecture 8  make. Using make for compilation  With medium to large software projects containing many files, it’s difficult to: Type commands to compile.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
Makefiles1 MAKEFILES Purpose: contain UNIX commands and will run them in a specified sequence. Syntax Definition : { Section-name: {unix command #1} …
Basic Unix Commands & GCC Saurav Karmakar Spring 2007.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
Linux Stuff Last Update Copyright 2014 Kenneth M. Chipps Ph.D. 1.
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
Learning basic Unix command It 325 operating system.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
LINUX System : Lecture 5 text editor, compilation (make), … Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.
The make utility (original presentation courtesy of Alark Joshi)
Lecture 2 Linux Basic Commands,Shell and Make
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Brief Intro to Make CST494/ Gannod.
Lecture 2 Working with Files and Directories
Some Linux Commands.
The Command Prompt Commands are the way to “do things” in Unix
Useful Linux Commands.
Makefiles Caryl Rahn.
CS314 – Section 5 Recitation 1
Command Line Interface for Beginners
The Unix File System.
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
January 26th, 2004 Class Meeting 2
The make utility (original presentation courtesy of Alark Joshi)
Presentation transcript:

1 Linux Command

Advanced Compiler Laboratory2 Simple linux cmds ls List information about FILEs, by default the current directory. pwd Print Working Directory cd Change Directory - change the current working directory to a specific Folder.

Advanced Compiler Laboratory3 Simple linux cmds cp Copy one or more files to another location mv Move or rename files or directories. rm Remove files (delete/unlink) touch Change file timestamps, change the access and/or modification times of the specified files.

Advanced Compiler Laboratory4 Simple linux cmds mkdir Create new folder(s), if they do not already exist. rmdir Remove folder(s), if they are empty. cat Display the contents of a file (concatenate)

Advanced Compiler Laboratory5 Simple linux cmds passwd Modify a user password. chmod Change access permissions History Command Line history man Display helpful information about commands.

Advanced Compiler Laboratory6 make Definition make is utility to maintain groups of programs Object If some file is modified, make detects it and update files related with modified one. It can use to command based programs

Advanced Compiler Laboratory7 make basic rules 3 components target, dependency, command file format file name: Makefile format : target: dependency [tab] comand

Advanced Compiler Laboratory8 make example make 를 사용하지 않을때 $gcc –c main.c $gcc –c add.c $gcc –c sub.c $gcc –o test main.o add.o sub.o 혹은, gcc –o test main.c add.c sub.c

Advanced Compiler Laboratory9 make example test : main.o add.o sub.o gcc –o test main.o add.o sub.o main.o: addsub.h main.c gcc –c main.c add.o: add.c gcc –c add.c sub.o: sub.c gcc –c sub.c command 앞에는 반드시 [tab] 을 사용할 것

Advanced Compiler Laboratory10 make example 어느 때 어떤 target 이 다시 컴파일 될 것 인가 ? main.c 가 바뀌었을 경우 add.c 혹은 sub.c 가 바뀌었을 경우 addsub.h 가 바뀌었을 경우

Advanced Compiler Laboratory11 label clean: rm *.o test 레이블로 사용될 때는 의존관계 부분이 없 어도 된다. 실행 방법 make clean

Advanced Compiler Laboratory12 macro CC=gcc SRC=main.c add.c sub.c main: ${SRC} ${CC} –o test ${SRC}

Advanced Compiler Laboratory13 미리 정해져 있는 매크로 make –p 를 통하여 모든 값들을 확인 가능 ASFLAGS = <- as 명령어의 옵션 세팅 AS = as CFLAGS = <- gcc 의 옵션 세팅 CC = cc (= gcc) CPPFLAGS = <- g++ 의 옵션 CXX = g++ LDLFAGS = <- ld 의 옵션 세팅 LD = ld LFLAGS = <- lex 의 옵션 세팅 LEX = lex YFLAGS = <- yacc 의 옵션 세팅 YACC = yacc

Advanced Compiler Laboratory14 확장자 규칙 target 에 확장자 규칙을 적용 확장자를 보고 그에 따라 적절한 연산을 수행시키는 규칙.SUFFIX 매크로 make 파일에서 주의 깊게 처리할 파일들의 확장자 등 록.c.o.c 를 확장자로 가지는 파일을.o 를 확장자로 갖는 파 일로 바꾸는 규칙을 직접 정의

Advanced Compiler Laboratory15 확장자 규칙의 예.SUFFIXES :.c.o OBJECTS = main.o add.o sub.o CC = gcc CFLAGS = -g -c TARGET = test $(TARGET) : $(OBJECTS) $(CC) -o $(TARGET) $(OBJECTS).c.o : $(CC) $(CFLAGS) $< clean : rm -rf $(OBJECTS) $(TARGET) core main.o : addsub.h main.c add.o : addsub.h add.c sub.o : addsub.h sub.c

Advanced Compiler Laboratory16 확장자 규칙의 예 CC=gcc OBJS= main.o add.o sub.o test3:${OBJS} ${CC} –o ${OBJS}.c.o: gcc –c $<

Advanced Compiler Laboratory17 매크로 치환 $(MACRO_NAME:OLD=NEW) SRC=main.c OBJ=$(SRC:.c=.o) 참고 : 긴 명령어를 여러 라인으로 표현시 \ 사용 OBJS = shape.o \ pen.o\ marker.o

Advanced Compiler Laboratory18 Example 만들었던 Makefile 을 macro 와 확장자 규 칙을 이용하여 다시 바꾸어 보자.

Advanced Compiler Laboratory19 의존 관계 생성 gccmakedep 어떤 파일의 의존 관계를 자동으로 조사해서 Makefile 의 뒷부분에 자동으로 붙여주는 유틸 리티.SUFFIXES :.c.o CFLAGS = -O2 -g OBJS = main.o add.o sub.o SRCS = $(OBJS:.o=.c) test : $(OBJS) $(CC) -o test $(OBJS) dep : gccmakedep $(SRCS)

Advanced Compiler Laboratory20 Recursive Make 파일들이 여러 directory 에 나누어져 있고 각 sub-directory 에 makefile 이 존재 한 다면 ? subsystem: cd subdir;$(MAKE) subsystem: $(MAKE) –C subdir

Advanced Compiler Laboratory21 Example Recursive Makefile 을 작성해 보자.