Starting from:

$35

Project 3 537make command solution

## Description

The 537make command will look first for a file called "makefile"; if that is found, then it will take that file and build and run it's specifications. If it does not find "makefile", then it will look for a file called "Makefile". If neither file is found, then it will report an error and exit.




## Remaining Valgrind Errors

build_spec_graph.c :

The malloc is being used by our graph to hold the dependencies of the target. We asked a TA to confirm.

build_spec_graph.c :

The realloc is needed to expand the size of the array to store the dependencies that are also targets. We use this later to create the executable. We asked a TA to confirm.

build_spec_graph.c :

The realloc is needed to expand the size of the array to store the dependencies that are also targets. We use this later to create the executable. We asked a TA to confirm




## Valgrind Fixes

Line 98, text_parsing.c - Used calloc to initialize the values to 0.

Line 57, build_spec_repr.c - Changed the conditions to realloc to NodeArraySize -1 to insure an extra NULL at the end of the list.

Line 68, build_spec_repr.c - Initialized visited value for each node

Lines 79-81, build_spec_repr.c - Initialized all values of dependency array to NULL for all nodes

Lines 88-90, build_spec_repr.c - Initialized all values of command array to NULL for all nodes

Line 100, build_spec_repr.c - Changed the conditions to expand the array to guarantee a spot to add a NULL at the end of the array.

Lines 107-114, build_spec_repr.c - Initialized new values of dependency array to NULL for newly assigned mem locations after realloc

Line 104, build_spec_repr.c - Change the bound of the for loop to add an a NULL.

Line 120, build_spec_repr.c - Changed the condition to expand the array to guarantee a spot to add a NULL at the end of the array.

Line 124, build_spec_repr.c - Changed the bound of the for loop to add a NULL.

Lines 129-135, build_spec_repr.c - Initialized new values of command array to NULL for newly assigned mem locations after realloc

Line 76, build_spec_graph.c -Changed the conditions to realloc to ArraySize -1 to insure an extra NULL at the end of the list.

Lines 156-164, build_spec_repr.c - Freed memory from passed in string 3D array

Lines 210, build_spec_graph.c - Freed last malloc from arguments

Lines 211, build_spec_graph.c - Freed last malloc from arg

Lines 248-273, build_spec_graph.c - Freed entire commandBreakDown 3D array







## Included Files

main.c

This is the main routine of the program. In this file the main function is invoked which creates all three queues. Each of the four threads is then created and run to completion before the main function continues. After this the main function prints out the

queue stats for each StringQueue.




text_parsing.c

This file parses the specified file and converts each string into a 3D array segmented into block, lines, and words.




text_parsing.h

This is the header file for text_parsing.c that contains the method arguments.




build_spec_repr.c

This file takes the 3D array and places each target into a Node structure along with it's corresponding dependencies and commands. It then returns an array of these Nodes.




build_spec_repr.h

This is the header file for build_spec_repr.c that contains the method arguments and the Node structure initialization.




build_spec_graph.c

This file connects each node to all of it's dependencies and then traverses the newly formed graph to build the necessary specifications.




build_spec_graph.h

This is the header file for build_spec_graph.c that contains the method arguments.




proc_creation_prog_exec.c

This file takes a command and a 2D array of argument strings and executes that command and waits for it to return.




proc_creation_prog_exec.h

This is the header file for proc_creation_prog_exec.c that contains the method arguments.




Makefile

This file is the makefile for our program that can be run with the make command. It includes the CSA functionality.




makefile

This is the general makefile that can be used to compile our program. It does not use variables so it is compatiable with the

specifications of the program.




## Usage

The program can be run simply by typing:

% 537make

In this case, it will make the first build specification found in the file.




Alternatively, you can input a target name from the specified file for example:

% 537make readproc.o

In this case, it will make the build specification labeled "readproc.o".

More products