Your first task is to create a Makefile for a project. A project has been provided to you in the compressed file CSCI124-Lab3.zip. In this file you will find numerous headers and source files. You can ignore the fact the program is implemented using classes. The program once compiled takes a source file name and prints out the symbols in the file and line numbers they appear on. The function is largely irrelevant to the task at hand.
The program can be compiled easily by using:
$ g++ *.cp
That said this is not desirable. Your job is to create a Makefile, called makefile.txt which builds all the targets associated with the project and links them together to build the executable foobar. To do this you will need to review the files and understand the dependencies.
Your makefile should have a clean target to remove all objects and executables.
Place your solution in the file makefile.txt.
Your second task is to write a program, which does some pattern matching. Pattern matching is commonly used when we want to identify something in a file.
Your mission is to write a C++ program which can find header dependencies in C++ source files i.e. .cpp files.
An include can be of any of the following forms:
include directives indicate header file inclusion. The #include directive can appear on any line in a source file (or even within a header) and it need not begin on the first character of a line (there can be as much leading white space e.g. tabs and whitespace). As indicated above you can only have one #include per line but it may be proceeded by code or even comments, which can be ignored till the end of line.
Between the #include there can be any number of white space characters (including tabs etc) followed by either a < or “. Within the < or “ there is a string which is known as the dependency – such strings may have white spaces in them. The header string is typically followed by a closing > or “.
Your job is to write a program which prompts the user for a C++ source file and prints out all the dependencies. A C++ source file ends with a .cpp extension. If this is not met print an error and terminate.
A sample run of the program using the main.cpp from csci124-lab3.zip should yield the following:
Enter Filename: main.cpp
Where includes do not meet the above specified form, exclude it from the summary list. You only need to look for includes in the source file specified. You can assume there will only ever be one include per line.
Place your code to solve this problem into the file depend.cpp and depend.h. Write a suitable driver function and place it in main.cpp.
So, this is the output for task 1 , i not sure whether its correct anot , i wrote all them create .o object file in a text file(.txt).
Line Numbers: 1 2 4 7 8
Line Numbers: 5 8 11 14
Line Numbers: 1 2 4 5 7 8 10 11 13 14
Line Numbers: 2 5 8 11 14
Line Numbers: 4 7 10 13
Line Numbers: 1 2 4 10 11
Line Numbers: 1 2 4 13 14
Line Numbers: 1 2 4 5
Line Numbers: 2 4 7 10 13
Line Numbers: 1 2
Line Numbers: 1 2 4 13 14
Now , if task 1 is correct , what should i proceed with task 2?
Please give some idea ~ i nid to submit these in 2 day..