Faculty of Engineering and Mathematical Sciences 
Not logged in (login)


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting (CITS4407).
RSS cloud
Jump to:

Assignment 2 - Q1

1 of 390 articles shown, currently no other people reading this forum.
From: Nathan S.
Date: Tue 12th May, 2:47pm


"Christopher McDonald" <ch*i*.*c*o*a*[email protected]*a*e*u*a*> wrote:

> Hi Nathan,
> "Nathan Scott" <18*1*1*[email protected]*u*e*t*u*a*e*u*a*> wrote:
> > Nope, still do not get it, I watched the lecture, but maybe I missed a key concept from it or 
> > something.  The specification says that 'updateversion' is a 'shellscript', that means a bash script or 
> > a makefile or something else?  I would have thought 'make updateversion' would be like telling make 
> > (which I understand is some program) to run 'updateversion' which should have Makefile syntax inside, 
> > no?  If updateversion is a bash script, how is that going to work?  Can make run bash scripts?   
> A shellscript is a textfile of bash commands (of almost anything, typically in a one-command-per line format).
> We can have bash read and execute those commands by running:
>     bash filename
> or by making the shellscript (file) directly executable - chmod +x filename
> and then running  ./filename
> If a textfile is named 'Makefile', its contents will be read by the make program (when you run   make).
> It is not a shellscript.
> Is it a strictly formatted specification of the relationships between files (such as for a programming project, 
> but equally for any other form of files),  and command-sequences to build/create/update files, or to perform any 
> sort of action.
> Running   'make updateversion'
> ask the make program to find a target, named updateversion', in the Makefile and to run its associated commands if 
> necessary.
> Consider the target named 'clean' in the Makefile provided in the calcmarks example.
> We can run   'make clean'
> and make invokes the commands associated with the target.
> Because there never is a file named 'clean', the target always needs rebuilding, and the commands are thus always 
> executed.
> If you're still confused by it all, trace what would happen if your shellscript was named   updateversion.sh
> ??

ok, I get it now, I did not understand the target thing and that you could run a bash script from make.  Basically the 
key is this:
you can run any file from make.  You just put the commands in a target in make will run it, a bash script or anything 
So running this from the terminal: 

make -f xxxx yyyy  

will run the arbitrarily named makefile 'xxxx' with 'make' and output the evaluation of the target 'yyyy'.  All the 
dependencies etc are specified within 'xxxx' for the target 'yyyy'

so for example 'xxxx' could contain:
yyyy : 
        bash a_bash_script arg1 arg2 ....

Related articles

Assignment 2, Q1 (all 16) RSS
├─ original   Mon 11th May, 4:47pm, Mingbo Z.
├─ reply 1   Mon 11th May, 5:04pm, Christopher M.
├─ reply 2   Tue 12th May, 12:03pm, Nathan S.
├─ reply 3   Tue 12th May, 12:18pm, Christopher M.
├─ reply 4   Tue 12th May, 12:39pm, Nathan S.
├─ reply 5   Tue 12th May, 2:21pm, Christopher M.
├─ THIS   Tue 12th May, 2:47pm, Nathan S.
├─ reply 7   Tue 12th May, 2:58pm, Christopher M.
├─ reply 8   Tue 12th May, 7:56pm, David M.
├─ reply 9   Tue 12th May, 10:42pm, Thanh T.
├─ reply 10   Wed 13th May, 6:43am, Christopher M.
├─ reply 11   Wed 27th May, 1:19pm, Matthew W.
├─ reply 12   Wed 27th May, 3:42pm, Christopher M.
├─ reply 13   Wed 27th May, 4:50pm, Jichunyang L.
├─ reply 14   Thu 28th May, 9:39am, Christopher M.
└─ reply 15   Sun 31st May, 11:38am, Akhil E.
This Page

Program written by: [email protected]
Feedback welcome
Last modified:  3:57pm Aug 06 2020