You may choose to complete this project in a group of up to two students. Each group should turn in one copy with the names of all group members on it.

computer science

Description

Ground Rules. You may choose to complete this project in a group of up to two students. Each group should turn in one copy with the names of all group members on it. The code must be originally written by your group. No code from outside the course texts and slides may be used—your code cannot be copied or derived from the Web, from past offerings, other students, programmer friends, etc. All submissions must compile and run on any CSE Labs machine located in KH 4-250. A zip file should be submitted through Canvas by 11:59pm on Wednesday, Oct 9th. Note: Do not publicize this assignment or your answer to the Internet, e.g., public GitHub repo. To share code between team members, create a private repo in github.umn.edu. Objectives: The focus of this project is to (1) understand the concept of OS processes in C and the functionality of make Unix command. (2) We replicate some functionalities of makefile[1], via fork, exec, and wait system calls.


1 Project Description A makefile is often used to simplify the compilation and build process of large software tools, via the GNU make [2] command. The software installation targets are primarily UNIX like operating systems. A typical makefile has the following structure [1


Given a makefile filename and an optional target as command line arguments, your task is to generate an executable ’mymake’, from a C program. It must parse the makefile and build a dependency graph for the (optional) provided target. Also, execute the recipes for the said target, by spawning a new process per recipe, via fork and exec, as determined by the graph traversal. If no target is specified as a command line argument, the first target in the makefile is chosen. Alternatively, if your first argument is a print flag (-p) followed by the makefile, you must only print the target, dependencies, and recipes in the makefile. A second type of flag (-r) followed by the makefile must print the recipe order of the target. Do not fork/exec the recipes when running either of the flags. More details are described in the following three phases:


1.1 Parsing the input makefile The makefile consists of multiple targets and each target describes the dependencies that must be satisfied before executing the recipes within a target. Recipes, rules, and commands mean the same thing. In this project makefile, each target can either have multiple dependencies with one recipe in a new line. Targets and dependencies are separated by a colon (:). Multiple dependencies for a target are separated by space. Each recipe for a target must be indented via a single tab (\t, not 2/3/4/8 spaces). Recipes within the same target, must be executed in the order they appear. Blank lines are optional and improve readability. More assumptions about the file are presented later in the section 5 1 To simplify your job, we will provide a helper function that reads the contents of the makefile into a two dimensional char array. The first step is to parse these lines from a char array to accurately determine targets, dependencies, and recipes. We suggest adopting the technique described in makeargv.c from the textbook http://usp.cs.utsa.edu/usp/programs/chapter02/. One sample makefile is shown below:


Related Questions in computer science category