Dum Ka Biryani, Make for each other

Similar documents
Barista Document Output Object

Recursion. John Perry. Spring 2016

1. Installation 2. Transferring a Stackup from Altium Designer 3. Transferring a Stackup and Design Rules to Altium Designer

A Note on H-Cordial Graphs

John Perry. Fall 2009

Athithi Devo Bhava (Guest is Akin to God) History of Paradise. Good Food. Great Service. Happy Times.

raspador Documentation

Compiler. --- Lexical Analysis: Principle&Implementation. Zhang Zhizheng.

Lesson 41: Designing a very wide-angle lens

Simulation of the Frequency Domain Reflectometer in ADS

Managing Multiple Ontologies in Protégé

Welcome to the BeerSmith(TM) Help Page. This web oriented help system will help you enhance your brewing experience using BeerSmith.

Biologist at Work! Experiment: Width across knuckles of: left hand. cm... right hand. cm. Analysis: Decision: /13 cm. Name

Lesson 41: Designing a very wide-angle lens

Planning: Regression Planning

Objective: To observe fermentation and discuss the process. Problem: Will yeast give off significant amounts of gas to inflate a balloon?

KATY TANG. Flexible Retail Legislation File

AWRI Refrigeration Demand Calculator

Haystack at Scale in Australia & Data Driven Gap Analysis

Which of your fingernails comes closest to 1 cm in width? What is the length between your thumb tip and extended index finger tip? If no, why not?

WiX Cookbook Free Ebooks PDF

Algorithms. How data is processed. Popescu

TEST PROJECT. Server Side B. Submitted by: WorldSkills International Manuel Schaffner CH. Competition Time: 3 hours. Assessment Browser: Google Chrome

Liquid candy needs health warnings

CS 387: GAME AI PROCEDURAL CONTENT GENERATION

Package cdltools. August 1, 2016

Cafeteria Ordering System, Release 1.0

The Dun & Bradstreet Asia Match Environment. AME FAQ. Warwick R Matthews

Activity 10. Coffee Break. Introduction. Equipment Required. Collecting the Data

AGREEMENT n LLP-LDV-TOI-10-IT-538 UNITS FRAMEWORK ABOUT THE MAITRE QUALIFICATION

MUMmer 2.0. Original implementation required large amounts of memory

Fall 2015 Solutions. Biostats691F: Practical Data Management and Statistical Computing

Notes on the Philadelphia Fed s Real-Time Data Set for Macroeconomists (RTDSM) Capacity Utilization. Last Updated: December 21, 2016

Athithi Devo Bhava (Guest is Akin to God)

Tamanend Wine Consulting

Yelp Chanllenge. Tianshu Fan Xinhang Shao University of Washington. June 7, 2013

NVIVO 10 WORKSHOP. Hui Bian Office for Faculty Excellence BY HUI BIAN

rpr static-rs 10 rpr station-name 10 rpr timer 10 rpr weight 10 service 11 shutdown 11 stp tc-snooping 11 te-set-subtlv 11

What do Calls to Restaurants Signify?

PRODUCTION SOFTWARE FOR WINEMAKERS. Wine Operations and Laboratory Analyses

15-Annotating Plots text: Chapter ECEGR 101 Engineering Problem Solving with Matlab Professor Henry Louie

Liquid candy needs health warnings

Pani Puri Kothimbir Vadi Steamed Modak Paneer Biryani Paneer Pizza

Kashmiri Dum Aloo. There s nothing more comforting than meltingly-soft potatoes

Experiment # Lemna minor (Duckweed) Population Growth

SERVICE MANUAL ESPRESSO COFFEE BREWER UNITS

TEACHER NOTES MATH NSPIRED

ARM4 Advances: Genetic Algorithm Improvements. Ed Downs & Gianluca Paganoni

MyPlate ipad Webquest

CafeRomatica NICR7.. Fully automatic coffee centre Operating Instructions and Useful Tips. A passion for coffee.

Fondants & Fennel Seed Crème Fraîche

BREWERS ASSOCIATION CRAFT BREWER DEFINITION UPDATE FREQUENTLY ASKED QUESTIONS. December 18, 2018

KATY TANG. Flexible Retail Legislation File

Caffeine in Energy Drinks

Static Methods and Method Calls

IT tool training. Biocides Day. 25 th of October :30-11:15 IUCLID 11:30-13:00 SPC Editor 14:00-16:00 R4BP 3

Big Green Lessons Germination: Kindergarten-2 nd Grade

Case Study 8. Topic. Basic Concepts. Team Activity. Develop conceptual design of a coffee maker. Perform the following:

EUROPEAN PATENT OFFICE U.S. PATENT AND TRADEMARK OFFICE CPC NOTICE OF CHANGES 649 DATE: FEBRUARY 1, 2019 PROJECT RP0569

The R survey package used in these examples is version 3.22 and was run under R v2.7 on a PC.

Swiss Trade Mediamatics (Sample for year 2017)

2015 DEPARTMENT OF LABOR WAGE BOARD HEARING: RAISING THE MINIMUM WAGE FOR FAST FOOD WORKERS NFIB/NY STATE DIRECTOR MICHAEL DURANT JUNE 22, 2015

m-neat Section Worksheets Fast Food Restaurant

Injection, Modularity, and Testing

Barista at a Glance BASIS International Ltd.

Predicting Wine Quality

MODEL# GCM4500 COFFEE MAKER WITH GRINDER. PHOTO OF PRODUCT

A Brief Introduction Das U-Boot

Visit our website at: Mixed Vegetable Pickle Dried Fruit Pickle Mango Pickle Lime Pickle Chilli Pickle with Tamarind

Directions for Menu Worksheet ***Updated 9/2/2014 for SY *** General Information:

STA Module 6 The Normal Distribution

STA Module 6 The Normal Distribution. Learning Objectives. Examples of Normal Curves

Comparison of 256-bit stream ciphers

Biocides IT training Helsinki - 27 September 2017 IUCLID 6

Mini Project 3: Fermentation, Due Monday, October 29. For this Mini Project, please make sure you hand in the following, and only the following:

Package frambgrowth. April 24, 2018

An Introduction to DBIx::Class. Tom Hukins

Pevzner P., Tesler G. PNAS 2003;100: Copyright 2003, The National Academy of Sciences

Most Affordable Professional Grade 2D & 3D CAD Software

Environmental Monitoring for Optimized Production in Wineries

Association Rule Mining

SAT Planning in Description Logics: Solving the Classical Wolf Goat Cabbage Riddle. Michael Wessel

FOOD CONSISTENCY To successfully create or establish a brand, your product MUST be consistent.

Release Letter. Trufa

MBA 503 Final Project Guidelines and Rubric

classroomsecrets.com The Mayan Cookbook Year 4 Teaching Information

Coffee Roasting Using Gene Café (GC) - Tips and Techniques

Nutrition Environment Assessment Tool (NEAT)

INTERNATIONAL STANDARD

Directions for Menu Worksheet. General Information:

H A V E L I P O N T E L A N D À LA CARTE MENU. HEAD CHEF Imamuddin Khan

Grapes of Class. Investigative Question: What changes take place in plant material (fruit, leaf, seed) when the water inside changes state?

Table Reservations Quick Reference Guide

FREQUENTLY ASKED QUESTIONS (FAQS)

ISO INTERNATIONAL STANDARD. Infusion equipment for medical use Part 6: Freeze drying closures for infusion bottles

CMC DUO. Standard version. Table of contens

Experiment 2: ANALYSIS FOR PERCENT WATER IN POPCORN

Properties of Water Lab: What Makes Water Special? An Investigation of the Liquid That Makes All Life Possible: Water!

Name Date. Materials 1. Calculator 2. Colored pencils (optional) 3. Graph paper (optional) 4. Microsoft Excel (optional)

UNEQUAL FLANGE EQUIPMENT RACKS

Transcription:

Dum Ka Biryani, Make for each other Version 1.0 February 2011 GNU Free Documentation License Shakthi Kannan shakthimaan@gmail.com http://www.shakthimaan.com () Dum Ka Biryani, Make for each other 1 / 1

Dum Ka Biryani () Dum Ka Biryani, Make for each other 2/1

2.1 What a Rule Looks Like target : prerequisites... recipe...... Tab before recipe! () Dum Ka Biryani, Make for each other 3 / 1

2.2 A Simple biryani : masala.o rice.o onion.o curd.o coriander.o meat.o cc -o biryani masala.o rice.o onion.o curd.o coriander.o meat.o masala.o : masala.c masala.h defs.h cc -c masala.c rice.o : rice.c rice.h defs.h cc -c rice.c onion.o : onion.c defs.h cc -c onion.c curd.o : curd.c defs.h cc -c curd.c coriander.o : coriander.c defs.h cc -c coriander.c meat.o : meat.c defs.h cc -c meat.c clean: rm biryani \ masala.o rice.o onion.o curd.o coriander.o meat.o () Dum Ka Biryani, Make for each other 4 / 1

2.4 Variables Make s Simpler objects = masala.o rice.o onion.o curd.o coriander.o meat.o biryani : $(objects) cc -o biryani $(objects) masala.o : masala.c masala.h defs.h cc -c masala.c rice.o : rice.c rice.h defs.h cc -c rice.c onion.o : onion.c defs.h cc -c onion.c curd.o : curd.c defs.h cc -c curd.c coriander.o : coriander.c defs.h cc -c coriander.c meat.o : meat.c defs.h cc -c meat.c clean: rm biryani $(objects) () Dum Ka Biryani, Make for each other 5 / 1

2.5 Letting make Deduce the Recipes objects = masala.o rice.o onion.o curd.o coriander.o meat.o biryani : $(objects) cc -o biryani $(objects) masala.o : masala.h defs.h rice.o : rice.h defs.h onion.o : defs.h curd.o : defs.h coriander.o : defs.h meat.o : defs.h clean: rm biryani $(objects) () Dum Ka Biryani, Make for each other 6 / 1

2.6 Another Style of objects = masala.o rice.o onion.o curd.o coriander.o meat.o biryani : $(objects) cc -o biryani $(objects) $(objects) : defs.h masala.o : masala.h rice.o : rice.h clean: rm biryani $(objects) () Dum Ka Biryani, Make for each other 7 / 1

2.7 Rules for Cleaning the Directory objects = masala.o rice.o onion.o curd.o coriander.o meat.o biryani : $(objects) cc -o biryani $(objects) $(objects) : defs.h masala.o : masala.h rice.o : rice.h.phony : clean clean: -rm biryani $(objects) () Dum Ka Biryani, Make for each other 8 / 1

3.1 What s Contain * Explicit rule onion.o : onion.c defs.h cc -c onion.c * Implicit rule masala.o : masala.h * Variable definition objects = masala.o rice.o onion.o curd.o coriander.o meat.o * Directive ifeq ($(CC), gcc) libs=$(libs for gcc) else libs=$(normal libs) endif * Comments # This is a comment () Dum Ka Biryani, Make for each other 9 / 1

3.2 What Name to Give Your Default * GNU * makefile * () Dum Ka Biryani, Make for each other 10 / 1

3.2 What Name to Give Your Default * GNU * makefile * $ make $ make -f my $ make --file=my () Dum Ka Biryani, Make for each other 10 / 1

3.3 Including Other s * Syntax include filenames... * Regex and variables allowed include foo *.mk $(bar) * To ignore if not found -include filenames... () Dum Ka Biryani, Make for each other 11 / 1

3.3 Including Other s * Syntax include filenames... * Regex and variables allowed include foo *.mk $(bar) * To ignore if not found $ make -include filenames... $ make -I $ make --include-dir () Dum Ka Biryani, Make for each other 11 / 1

3.6 Overriding Part of Another GNUmakefile meat: cc -c vegetables.c %: force @$(MAKE) -f $@ force: ; () Dum Ka Biryani, Make for each other 12 / 1

3.6 Overriding Part of Another GNUmakefile meat: cc -c vegetables.c %: force @$(MAKE) -f $@ force: ; $ make $ make meat () Dum Ka Biryani, Make for each other 12 / 1

3.7 How make Reads a First phase * Reads all makefiles * Reads included makefiles * Internalize variables, values, implicit and explicit rules * Constructs dependency graph of targets and pre-requisites * immediate: expansion in phase one Second phase * Determines which targets need to be re-built * Invokes the necessary rules * deferred: expansion in phase two () Dum Ka Biryani, Make for each other 13 / 1

3.7 How make Reads a Variable assignment * immediate = deferred * immediate?= deferred * immediate := immediate * immediate += deferred or immediate immediate, if variable was previously set as a simple variable (:=) deferred, otherwise Second phase * Determines which targets need to be re-built * Invokes the necessary rules * deferred: expansion in phase two () Dum Ka Biryani, Make for each other 14 / 1

3.7 How make Reads a Conditional Directives * immediate Rule Definition target : prerequisites... recipe...... immediate : immediate ; deferred deferred () Dum Ka Biryani, Make for each other 15 / 1

4.2 Rule Syntax * First target as default, if not specified. * A rule tells make two things: when the targets are out of date (prerequisites), and how to update them (recipe) when necessary. target : prerequisites... recipe...... target : prerequisites ; recipe recipe...... () Dum Ka Biryani, Make for each other 16 / 1

4.4 Using Wildcard Characters in File Names clean : rm -f *.o Wildcard expansion does not happen in variable definition objects = *.o Use Wildcard function! objects = $(wildcard *.o) () Dum Ka Biryani, Make for each other 17 / 1

4.5 Searching Directories for Prerequisites VPATH make variable VPATH = src:../headers vpath Directive vpath pattern directories vpath %.h../headers To clear search paths: vpath pattern vpath %.h vpath () Dum Ka Biryani, Make for each other 18 / 1

4.5.4 Writing Recipes with Directory Search Automatic variables $ˆ all prerequisites $@ target $< first prerequisite coriander.o : coriander.c cc -c $(CFLAGS) $^ -o $@ masala.o : masala.c masala.h defs.h cc -c $(CFLAGS) $< -o $@ () Dum Ka Biryani, Make for each other 19 / 1

4.6 Phony Targets Error in submake ignored: SUBDIRS = masala rice onion subdirs : for dir in $(SUBDIRS); do \ $(MAKE) -C $$dir; \ done SUBDIRS = masala rice onion.phony : subdirs $(SUBDIRS) subdirs: $(SUBDIRS) $(SUBDIRS): $(MAKE) -C $@ () Dum Ka Biryani, Make for each other 20 / 1

4.12 Static Pattern Rules * Override implicit rule. * No uncertainity. targets... : target-pattern: prereq-patterns... recipe... objects = curd.o coriander.o masala.o all: $(objects) $(objects): %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ () Dum Ka Biryani, Make for each other 21 / 1

5.1 Recipe Syntax * Follows shell syntax. * Backslash-newline pairs are preserved and passed to the shell. all : @echo In a cooking vessel\ add a layer of semi-cooked Basmati rice @echo Add meat on this\ rice layer @echo Add another layer \ of rice @echo Sprinkle the ingredients with water and cook () Dum Ka Biryani, Make for each other 22 / 1

5.1 Recipe Syntax * Follows shell syntax. * Backslash-newline pairs are preserved and passed to the shell. all : @echo In a cooking vessel\ add a layer of semi-cooked Basmati rice @echo Add meat on this\ rice layer @echo Add another layer \ of rice @echo Sprinkle the ingredients with water and cook $ make In a cooking vessel add a layer of semi-cooked Basmati rice Add meat on this rice layer Add another layer of rice Sprinkle the ingredients with water and cook () Dum Ka Biryani, Make for each other 22 / 1

5.1.2 Using Variables in Recipes LIST = masala rice onion all: for i in $(LIST); do \ echo $$i; \ done () Dum Ka Biryani, Make for each other 23 / 1

5.1.2 Using Variables in Recipes LIST = masala rice onion all: for i in $(LIST); do \ echo $$i; \ done $ make masala rice onion () Dum Ka Biryani, Make for each other 23 / 1

5.4 Parallel Execution * -j number, number of recipies to execute in parallel. * -l number, number (limit) of jobs to run in parallel. () Dum Ka Biryani, Make for each other 24 / 1

5.4 Parallel Execution * -j number, number of recipies to execute in parallel. * -l number, number (limit) of jobs to run in parallel. $ make $ make -j $ make --jobs $ make -l $ make --max-load () Dum Ka Biryani, Make for each other 24 / 1

5.5 Errors in Recipes * Ignore errors in a recipe line. clean : -rm -f *.o () Dum Ka Biryani, Make for each other 25 / 1

5.7 Recursive Use of make * Recursive make commands should always use the variable MAKE. subsystem : cd subdir && $(MAKE) subsystem : $(MAKE) -C subdir () Dum Ka Biryani, Make for each other 26 / 1

5.7.2 Communicating Variables to Sub-make variable = value export variable... unexport variable... export variable = value export variable := value export variable += value () Dum Ka Biryani, Make for each other 27 / 1

5.8 Defining Canned Recipes define mix-masala= @echo "Adding green chillies" @echo "Adding ginger garlic paste" @echo "Adding cinnamon, cardamom" @echo "Adding fried onions" @echo "Adding coriander and mint leaves" endef mix: $(mix-masala) () Dum Ka Biryani, Make for each other 28 / 1

5.8 Defining Canned Recipes define mix-masala= @echo "Adding green chillies" @echo "Adding ginger garlic paste" @echo "Adding cinnamon, cardamom" @echo "Adding fried onions" @echo "Adding coriander and mint leaves" endef mix: $(mix-masala) $ make $ make mix Adding green chillies Adding ginger garlic paste Adding cinnamon, cardamom Adding fried onions Adding coriander and mint leaves () Dum Ka Biryani, Make for each other 28 / 1

6.2 The Two Flavors of Variables * Recursively Expanded variable spice = $(chillies) chillies = $(both) both = green chillies and red chillie powder all: ; echo $(spice) () Dum Ka Biryani, Make for each other 29 / 1

6.2 The Two Flavors of Variables * Recursively Expanded variable spice = $(chillies) chillies = $(both) both = green chillies and red chillie powder all: ; echo $(spice) $ make green chillies and red chillie powder () Dum Ka Biryani, Make for each other 29 / 1

6.2 The Two Flavors of Variables * Simply Expanded variable chillie := red chillie spice := $(chillie) powder, green chillies chillie := green chillies all: echo $(spice) echo $(chillie) () Dum Ka Biryani, Make for each other 30 / 1

6.2 The Two Flavors of Variables * Simply Expanded variable chillie := red chillie spice := $(chillie) powder, green chillies chillie := green chillies all: echo $(spice) echo $(chillie) $ make red chillie powder, green chillies green chillies () Dum Ka Biryani, Make for each other 30 / 1

6.2 The Two Flavors of Variables * Conditional Variable assignment operator ifeq ($(origin RICE), undefined) RICE = Basmati rice endif RICE?= Basmati rice () Dum Ka Biryani, Make for each other 31 / 1

6.3.1 Substitution References masala := chillies.o onions.o garlic.o ginger.o biryani := $(masala:.o=.c) masala := chillies.o onions.o garlic.o ginger.o biryani := $(masala:%.o=%.c) * biryani is set to chillies.c onions.c garlic.c ginger.c () Dum Ka Biryani, Make for each other 32 / 1

6.3.2 Computed Variable Names greeny = coriander coriander = green coriander leaves leaves := $($(greeny)) all: @echo $(leaves) () Dum Ka Biryani, Make for each other 33 / 1

6.3.2 Computed Variable Names greeny = coriander coriander = green coriander leaves leaves := $($(greeny)) all: @echo $(leaves) $ make green coriander leaves () Dum Ka Biryani, Make for each other 33 / 1

6.6 Appending More Text to Variables objects = masala.o rice.o onion.o curd.o... objects += coriander.o CFLAGS = $(includes) -O... CFLAGS += -pg () Dum Ka Biryani, Make for each other 34 / 1

6.7 The override Directive override variable = value override variable := value override variable += more text override CFLAGS += -g override define masala= more-masala endef () Dum Ka Biryani, Make for each other 35 / 1

6.9 Undefining Variables water := saffron water leaves = mint leaves undefine water undefine leaves override undefine CFLAGS () Dum Ka Biryani, Make for each other 36 / 1

6.11 Target-specific Variable Values target... : variable-assignment prog : CFLAGS = -g prog : masala.o rice.o onion.o () Dum Ka Biryani, Make for each other 37 / 1

6.12 Pattern-specific Variable Values pattern... : variable-assignment %.o : CFLAGS = -O %.o: %.c $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ lib/%.o: CFLAGS := -fpic -g %.o: CFLAGS := -g all: rice.o lib/masala.o () Dum Ka Biryani, Make for each other 38 / 1

7.1 Example of a Conditional libs for gcc = -lgnu normal libs = biryani : $(objects) ifeq ($(CC), gcc) libs=$(libs for gcc) else libs=$(normal libs) endif () Dum Ka Biryani, Make for each other 39 / 1

7.2 Syntax of Conditionals conditional-directive text-if-true endif conditional-directive text-if-true else text-if-false endif conditional-directive text-if-one-is-true endif else conditional-directive text-if-true else text-if-false endif () Dum Ka Biryani, Make for each other 40 / 1

7.2 Syntax of Conditionals Four conditional directives: * ifeq * ifneq * ifdef * ifndef ifeq ($(CC), gcc) ifneq ($(STRIP), strip) ifdef $(LIBS) ifndef $(CFLAGS) () Dum Ka Biryani, Make for each other 41 / 1

8.1 Function Call Syntax $(function arguments) ${function arguments} comma :=, empty := space:= $(empty) $(empty) masala:= chillies onion garlic ginger list:= $(subst $(space),$(comma),$(masala)) list is now chillies,onion,garlic,ginger () Dum Ka Biryani, Make for each other 42 / 1

8.2 Functions for String Substitution and Analysis $(subst from,to,text ) $(patsubst pattern,replacement,text ) $(strip string ) $(findstring find,in ) $(filter pattern...,text ) $(filter-out pattern...,text ) $(sort list ) $(word n, text ) () Dum Ka Biryani, Make for each other 43 / 1

8.3 Functions for File Names $(dir names... ) $(notdir names... ) $(suffix names... ) $(basename names... ) $(addsuffix suffix,names... ) $(addprefix prefix,names... ) $(join list1, list2 ) $(wildcard pattern ) () Dum Ka Biryani, Make for each other 44 / 1

8.4 Functions for Conditionals $(if condition,then-part[,else-part] ) $(or condition1[,condition2[,condition3...]] ) $(and condition1[,condition2[,condition3...]] ) () Dum Ka Biryani, Make for each other 45 / 1

8.5 The foreach Function $(foreach var,list,text ) find files = $(wildcard $(dir)/*) dirs := masala rice leaves files := $(foreach dir, $(dirs), $(find files)) () Dum Ka Biryani, Make for each other 46 / 1

8.6 The call Function $(call variable,param,param,... ) reverse = $(2) $(1) make = $(call reverse,cook,mix) make contains mix cook () Dum Ka Biryani, Make for each other 47 / 1

8.7 The value Function $(value variable ) LIST = $PATH all: @echo $(LIST) @echo $(value LIST) () Dum Ka Biryani, Make for each other 48 / 1

8.7 The value Function $(value variable ) LIST = $PATH all: @echo $(LIST) @echo $(value LIST) $ make ATH /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin () Dum Ka Biryani, Make for each other 48 / 1

8.9 The origin Function $(origin variable ) How the variable was defined: * undefined * default * environment * environment override * file * command line * automatic () Dum Ka Biryani, Make for each other 49 / 1

8.10 The flavor Function $(flavor variable ) Flavor of the variable: * undefined * recursively expanded variable * simply expanded variable () Dum Ka Biryani, Make for each other 50 / 1

8.11 The shell Function contents := $(shell cat onion.c) files := $(shell echo *.c) () Dum Ka Biryani, Make for each other 51 / 1

References GNU Make: http://www.gnu.org/software/make/ GNU Make Manual: http://www.gnu.org/software/make/manual/ Dum Ka Biryani, Make for each other (sources): http://www.shakthimaan.com/downloads.html#dum-ka-biryani-make-for-each-other Symbols in LaTeX and HTML: http://newton.ex.ac.uk/research/qsystems/people/sque/symbols/ () Dum Ka Biryani, Make for each other 52 / 1