Sie sind auf Seite 1von 2

Assignment 1

Makefile

Embedded Logic Design


August 5, 2016

1 Part A
Create a program which is capable of printing Hello world on the screen. Follow the convention which
states that while the c-file contains the actual functionality, it is accompanied by a corresponding header
file (.h) which contains the prototypes of the functions located in the c-file. Further, the header file has
the same filename as the c-file, just the extension differs. For instance:

1 #include h e l l o W o r l d . h
2 int helloWorld ( ) {
3 ....
4 }

Listing 1: helloWorld.c or helloWorld.cpp

1 #include <s t d i o >


2 int helloWorld ( ) ;
Listing 2: helloWorld.h or hellowWorld.hpp

1. For this assignment, you have to create 2 c-files (including their accompanying header files). In one
c-file a function of printing Hello needs to be implemented, while the second c-file puts world
on the screen. None of the c-files must contain a main().
2. Create a third c-file which includes all required header files (not a single c-file is allowed to be
included) and invokes the functions implemented in (1) in such a way that Hello world is printed
on the screen.
3. Create a Makefile and provide targets and recipes/rules to compile the files implemented in (1)
into object files (.o). Use as many variables as possible, so that changes can be made easily. At
least you should use variables for the objects, compiler tool chain executable, source code filename,
filename of the resulting executable and compiler flags.
4. Add a target/rule to link the object files together with the c-file containing the main() function
into an executable. Have a look at the Biryani recipe uploaded to get to know, how to use place
holders.
5. Make sure that your Makefile only compiles those objects, which changed, while leaving all un-
modified files.
6. Add another rule (clean), which removes all created objects and executables.
7. Create a zip file containing your source code and send it as attachment to alex@iiitd.ac.in with
the subject line ELD Assignment 1. The deadline is at 11:59pm on Friday, 12th.

This assignment needs to be completed individually.

1
2 Part B
Find a group partner and announce your group partner in this form: http://goo.gl/forms/vjd1pUh5ic
(You just have to do it once, your group partner does not have to do it.)

Das könnte Ihnen auch gefallen