TUD Logo

TUD Startseite » ... » Lehre » Komplexpraktikum systemnahe Programmierung » Make zur Automatisierung


Aufgabe 1: Make zur Automatisierung


Please, submit your solution by e-mail to: weinhold (at) os.inf.tu-dresden.de. Don't attach anything to the e-mail (like pdf, docs etc.) other than the requested source code and a Makefile within a tar-archive.


In this exercise you are going to learn how to use GNU/Make in order to automate compiling and linking C files into an application. Perform the following steps:

  1. Write a C application sincos that prints a table of sin/cos values for angles between 0 and 360 degrees. The application receives exactly one argument which is the number of steps to use for printing.

    A sample session with your program might look like this:

    			$> ./sincos 10
    			0.000           0.000           1.000
    			36.000          0.588           0.809
    			72.000          0.951           0.309
    			108.000         0.951           -0.309
    			144.000         0.588           -0.809
    			180.000         -0.000          -1.000
    			216.000         -0.588          -0.809
    			252.000         -0.951          -0.309
    			288.000         -0.951          0.309
    			324.000         -0.588          0.809
    			360.000         0.000           1.000

    Your application shall consist of 2 C files:

    • main.c: This file contains the main method of your application, checks the correctness of the command line parameter and then calls a function provided by the second file in order to perform real actions.
    • sincos.c: This file provides a function that iterates over the range between 0 and 360 degrees using the steps provided by the user. For each iteration it prints the current degree value as well as its sine and cosine.
    • The interface provided by sincos.c shall be defined in a header file that is included by the main application.
  2. Write a Makefile to automate your application's build. The Makefile shall consist of three rules:

    • A rule to create the program from your two object files,
    • A clean rule to remove all generated files, and
    • A rule to automatically generate dependencies.

    Furthermore, the program shall be compiled with the compiler flag -Wall and compilation should not emit any warnings.

  3. Compile and link the application using GNU/Make.
  4. Test the correctness of your dependencies and file generation. The reference computer for this purpose is the FRZ's Ganymed.

Sending in solutions

Solutions consist of a tarball containing all files necessary to evaluate your solution. Creating a tarball works like this:

	   	$> make clean
		$> cd ..
		$> tar cvzf <your_login>_exercise1.tgz <directory>/*

Thereafter, send <your_login>_exercise1.tgz to the email address given above.


Stand: 6.1.2020, 14:15 Uhr
Autor: Dipl.-Math. Martin Küttler

Martin K├╝ttler

  • ModuleModule: INF-MA-PR, INF-E-4, DSE-E14
  • 0/0/4 = 4 SWS