Makefile helps

Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Makefile helps
# 1  
Makefile helps

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
The code in project2 is for a program that formats C++ code into HTML for presentation in a webpage. For example, here is the web page produced by running the command

Code:
./cpp2html < ~/UnixCourse/compileAsst/guess.cpp > guess.html

(once the program has been successfully compiled, of course).

This program would have been a massive undertaking to write in pure C or C++, but was actually put together quite quickly using a software tool called “flex” that was originally developed for use in building compilers. Whats interesting about flex is that it actually writes out the program code for a substantial portion of a compiler (the “scanner” or “lexical analyzer”) from a (relatively speaking) simple description of what the language being processed looks like.

The steps necessary to produce this program are:

Compile cpp2html.c to produce cpp2html.o. ( Important: the source code in this project is C, not C++, and so must be compiled and linked with gcc, not g++.)

Run the command

Code:
flex cppscanner.l

to produce the file lex.yy.c from the language description in cppscanner.l.

Compile lex.yy.c to produce lex.yy.o. (This often produces a warning message about extra tokens. Ignore it.)

Link the the .o files to produce an executable program named cpp2html

Write a makefile that will carry out these steps. Your makefile should result in only the minimum required amount of steps when any input file to this process is changed. (Note: you will probably not be able to base this makefile upon my self-updating makefile as in the earlier part of the assignment. Instead, you will probably find it necessary to write this one from scratch.





2. The attempts at a solution (include all code and scripts):

Code:
cpp2html: cpp2html.o lex.yy.o
        gcc -g -DDEBUG cpp2html.o lex.yy.o
        mv a.out cpp2html

lex.yy.o: lex.yy.c
        gcc -g -DDEBUG -c lex.yy.c

lex.yy.c:
        flex cppscanner.l

cpp2html.o: cpp2html.c
        gcc -g -DDEBUG -c cpp2html.c

when i ran the code to check my makefile it gave the error
Code:
"Your makefile does not invoke flex when only cppscanner.l has been changed:
make: `cpp2html' is up to date."

Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!




3. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Old Dominion University, Norfolk Virginia, United States. Professor Steven Zeil, CS 252

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Last edited by RudiC; 04-16-2018 at 01:58 PM.. Reason: Changed CODE tags.
# 2  
List cppscanner.l as a dependency of lex.yy.c, a la
Code:
lex.yy.c:cppscanner.l

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #530
Difficulty: Medium
Unicode was supports encoding 1,112,064 possible characters.
True or False?

5 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

FTP Client helps bash + awk

FTP Client helps bash + awk Good afternoon, Dear I have a script that performs a file sent to another server the process is simple but moving large volume of information is run through crontab every 30 minutes, is that the scritp connected to Windows servers, I have unix (solaris 5.10), the... (6 Replies)
Discussion started by: arnolkat
6 Replies

2. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

3. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

4. Solaris

How does an Administrator helps Progremmers

hi, How does an Administrator helps Progremmers ? (2 Replies)
Discussion started by: sol8admin
2 Replies

5. UNIX for Dummies Questions & Answers

this helps me out big time

ever since i started playing with unix at work i have found all kinds of helpful tools that my companie has added into our /usr/bin/ this is the one that helped the most """"""ldr""""""" #!/bin/sh # # @(#) %filespec: ldr-2 % %date_modified: Wed Sep 6 09:54:07 2000 % # # ... (4 Replies)
Discussion started by: jerzey4life
4 Replies

Featured Tech Videos