In this project, you will simulate working on a large project containing many different files. Many times with large projects, in order to keep things neat and orderly, source and include files are distributed across several directories. Generally (but not always), source (*.c) files are kept in a directory named src/, include (*.h) files are kept in a directory named inc/ (or sometimes include/), and object files are kept in a directory named obj/. The executables for large projects are also generally kept in a directory named bin/.
You will create several source and include files, place them in the appropriate directories and create a Makefile that will compile and link an executable from these files.
Specifications
Perform the following steps for this project. It is strongly suggested that you begin working on this project early. It will probably take several sessions. It is best to perform all the steps on Zeus directly rather than doing them on your own computer and then copying them over to test on Zeus.
A.Create a directory named Project1
B.Inside the Project1 directory, make the following directories:
a.src
b.inc
c.obj
d.bin
e.lib
C.Download the Makefile, Project1.h and Project1.c files from Blackboard and place them in their respective directories (The Makefile goes in the Project1 directory - above the src/ inc/ obj/ and bin/ directories)
D.ook at the source code for Project1 and notice the function calls it contains. You are to create a stub source and include file that corresponds to each function call. Name each file after the function call it contains. For example, the code for function1() will be found in Function1.c and the function prototype will be found in Function1.h. The files you create will contain the following:
Each source file will contain:
#The standard #include statements for stdio.h and stdlib.h
#pre-processor macros to include its corresponding header file as well as Project1.h
#The implementation of the stub function corresponding to its (file) name
E.For each source file, place the following code in each function:
int i = 0;
int *p = (int *) malloc(sizeof(int) * ARRAY_SIZE);
if (p == NULL)
{
fprintf(stderr, "function1(): Error allocating pn");
exit(1);
}
printf("In function1()...n");
// Initialize the array
for (i=0; i<ARRAY_SIZE; i++)
{
p[i]=i;
}
// Print part of the array
for (i=0; i<PARTIAL_SIZE; i++)
{
printf("function1(): %s = %d,%s = %d ", PR(i),i,PR(p[i]), p[i]);
printf("n");
}
free(p);
F.Replace the "function1( )" character strings for each code segment with the name of the corresponding function name
G.Modify the Makefile, adding information as prompted by the comments in the file. Pay careful attention to the comments in the Makefile!
H.Compile your program using the make command. Run your program to show that it executes correctly. You should notice a lot of output.