Sponsored Content
Full Discussion: Utilizing the Make Command
Homework and Emergencies Homework & Coursework Questions Utilizing the Make Command Post 302798031 by lamentofking on Tuesday 23rd of April 2013 04:14:38 PM
Old 04-23-2013
[Solved] Utilizing the Make Command

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:
  • Compile cpp2html.c to produce cpp2html.o.
    ( Important: the source code in these files is C, not C++, and so must be compiled and linked with gcc, not g++.)
  • Run the command

    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.


2. Relevant commands, code, scripts, algorithms:
Nothing outside of the UNIX command library


3. The attempts at a solution (include all code and scripts):
My makefile

Code:
cpp2html.o: cpp2html.c
	gcc -g -DDEBUG -c cpp2html.c
	flex cppscanner.l

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

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

And here is the error I get when I get my makefile checked for completion:

Your makefile does not build 'cpp2html' when invoked:
gcc -g -DDEBUG -c cpp2html.c
flex cppscanner.l



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Old Dominion University, Norfolk (Virginia), USA, Mr. 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).
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

make command

Dear Guys , Kindly note that i have sun solaries 8 intel machine . i installed apache and it is working fine . i am installing perl5 , MD5 and CGI . but whenever i execute the commands , make , make test and make install i get error message : not found # make make: not found also i... (2 Replies)
Discussion started by: tamemi
2 Replies

2. Shell Programming and Scripting

command utilizing high CPU

Can anybody please help me on how to optimize following command as it use up a lot of CPU : tail -f $DIR3$DATE4.log |\ while read line do echo $line | egrep "Processing incoming SMS message" | sed 's/\,/ /g' \ | awk '{print $2}' >> $DIR2/LIST1.$DATE4.log && echo... (6 Replies)
Discussion started by: azmanw2004
6 Replies

3. Shell Programming and Scripting

Utilizing func keys in scripts

I would like to have the function keys available to me in my scripts. Anyone have any ideas on how to map these to functionality I design? :confused: (3 Replies)
Discussion started by: fjjlee
3 Replies

4. Solaris

how to make all of this in one command

dears what i need to make is cp -irp file_name filename tar cvf filename.tar filename gzip filename.tar in one commane using exec it that prossible and how can i do that (4 Replies)
Discussion started by: xxmasrawy
4 Replies

5. Shell Programming and Scripting

Utilizing libraries when you aren't root.

I'm having a bit of trouble trying to make use of Net::SSH::Expect. I've started getting dependent libraries and set PERL5LIB to add my custom path because I don't have root access. I tried using cpan, but it always tries to use paths I don't have access to. Next, I tried just moving the .pm... (1 Reply)
Discussion started by: mrwatkin
1 Replies

6. UNIX for Dummies Questions & Answers

Unknown process utilizing CPU.

Hi i recently observed my cpu being used 100% due to which load average on machine get increased to < 5. I have no idea what the process is? Appreciate any help in this regard. root 15859 99.9 0.0 5668 1592 pts/4 R+ 12:28 660:06 \_ pvs root 7334 99.9 ... (2 Replies)
Discussion started by: pinga123
2 Replies

7. Solaris

Ram not utilizing

We are using oracle database on solaris 10 sparc 64 bit on M5000 machine. we facing performance related issues. We diagnose using prstat -a command that oracle user not utilizing the ram more than 30 gb total we have 64 gb ram available as in project max-shm-memory set to 42 gb . We are running... (2 Replies)
Discussion started by: zeeshan047
2 Replies

8. Homework & Coursework Questions

Utilizing the Make Command

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: ]Compile cpp2html.c to produce cpp2html.o. ( Important: the source code in these files is C, not C++, and so... (1 Reply)
Discussion started by: bgnaranjo1
1 Replies

9. HP-UX

NFSd command utilizing more cpu

Hi, I see following 'nfsd' command is using more CPU. Could someone please comment on it's pros and cons of it? CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND 5 ? 16890 root 152 20 34696K 12036K run 57166:48 856.13 854.64 nfsd OS -- HP-UX One... (4 Replies)
Discussion started by: Maddy123
4 Replies

10. UNIX for Beginners Questions & Answers

How to make df command?

in RHEL 6.10, how can we make the the df -k return the output without wrapping. And wihout using the df -Pk option. After we patched a Linux server from 6.5 to 6.10: The df -k on RHAT 6.10 it wraps the line for ex: 6.10: /dev/mapper/vgapp01-vendor ... (2 Replies)
Discussion started by: mrn6430
2 Replies
MAKE(1) 						      General Commands Manual							   MAKE(1)

NAME
make - maintain program groups SYNOPSIS
make [ -f makefile ] [ option ] ... file ... DESCRIPTION
Make executes commands in makefile to update one or more target names. Name is typically a program. If no -f option is present, `make- file' and `Makefile' are tried in order. If makefile is `-', the standard input is taken. More than one -f option may appear. Make updates a target if it depends on prerequisite files that have been modified since the target was last modified, or if the target does not exist. Makefile contains a sequence of entries that specify dependencies. The first line of an entry is a blank-separated list of targets, then a colon, then a list of prerequisite files. Text following a semicolon, and all following lines that begin with a tab, are shell commands to be executed to update the target. If a name appears on the left of more than one `colon' line, then it depends on all of the names on the right of the colon on those lines, but only one command sequence may be specified for it. If a name appears on a line with a double colon :: then the command sequence following that line is performed only if the name is out of date with respect to the names to the right of the double colon, and is not affected by other double colon lines on which that name may appear. The special form of the name: a(b) means the file named b stored in the archive named a. Sharp and newline surround comments. The following makefile says that `pgm' depends on two files `a.o' and `b.o', and that they in turn depend on `.c' files and a common file `incl'. pgm: a.o b.o cc a.o b.o -lm -o pgm a.o: incl a.c cc -c a.c b.o: incl b.c cc -c b.c Makefile entries of the form string1 = string2 are macro definitions. Subsequent appearances of $(string1) or ${string1} are replaced by string2. If string1 is a single character, the parentheses or braces are optional. All environment variables are assumed to be macro definitions and processed as such. The environment variables are processed before any makefile macro definitions; thus, macro assignments in a makefile override environmental variables. The -e option causes the environment to override the macro assignments in a makefile. Finally, command line options of the form string1=string2 override both environment and makefile macro definitions. Make infers prerequisites for files for which makefile gives no construction commands. For example, a `.c' file may be inferred as prereq- uisite for a `.o' file and be compiled to produce the `.o' file. Thus the preceding example can be done more briefly: pgm: a.o b.o cc a.o b.o -lm -o pgm a.o b.o: incl Prerequisites are inferred according to selected suffixes listed as the `prerequisites' for the special name `.SUFFIXES'; multiple lists accumulate; an empty list clears what came before. Order is significant; the first possible name for which both a file and a rule as described in the next paragraph exist is inferred. The default list is .SUFFIXES: .out .o .c .e .r .f .y .l .s .p The rule to create a file with suffix s2 that depends on a similarly named file with suffix s1 is specified as an entry for the `target' s1s2. In such an entry, the special macro $* stands for the target name with suffix deleted, $@ for the full target name, $< for the com- plete list of prerequisites, and $? for the list of prerequisites that are out of date. For example, a rule for making optimized `.o' files from `.c' files is .c.o: ; cc -c -O -o $@ $*.c Certain macros are used by the default inference rules to communicate optional arguments to any resulting compilations. In particular, `CFLAGS' is used for cc(1) options, `FFLAGS' for f77(1) options, `PFLAGS' for pc(1) options, and `LFLAGS' and `YFLAGS' for lex and yacc(1) options. In addition, the macro `MFLAGS' is filled in with the initial command line options supplied to make. This simplifies maintaining a hierarchy of makefiles as one may then invoke make on makefiles in subdirectories and pass along useful options such as -k. Another special macro is `VPATH'. The `VPATH' macro should be set to a list of directories separated by colons. When make searches for a file as a result of a dependency relation, it will first search the current directory and then each of the directories on the `VPATH' list. If the file is found, the actual path to the file will be used, rather than just the filename. If `VPATH' is not defined, then only the current directory is searched. One use for `VPATH' is when one has several programs that compile from the same source. The source can be kept in one directory and each set of object files (along with a separate makefile) would be in a separate subdirectory. The `VPATH' macro would point to the source directory in this case. Command lines are executed one at a time, each by its own shell. A line is printed when it is executed unless the special target `.SILENT' is in makefile, or the first character of the command is `@'. Commands returning nonzero status (see intro(1)) cause make to terminate unless the special target `.IGNORE' is in makefile or the command begins with <tab><hyphen>. Interrupt and quit cause the target to be deleted unless the target is a directory or depends on the special name `.PRECIOUS'. Other options: -e Environmental variables override assignments within makefiles. -i Equivalent to the special entry `.IGNORE:'. -k When a command returns nonzero status, abandon work on the current entry, but continue on branches that do not depend on the current entry. -n Trace and print, but do not execute the commands needed to update the targets. -t Touch, i.e. update the modified date of targets, without executing any commands. -r Equivalent to an initial special entry `.SUFFIXES:' with no list. -s Equivalent to the special entry `.SILENT:'. FILES
makefile, Makefile SEE ALSO
sh(1), touch(1), f77(1), pc(1), getenv(3) S. I. Feldman Make - A Program for Maintaining Computer Programs BUGS
Some commands return nonzero status inappropriately. Use -i to overcome the difficulty. Commands that are directly executed by the shell, notably cd(1), are ineffectual across newlines in make. `VPATH' is intended to act like the System V `VPATH' support, but there is no guarantee that it functions identically. 4th Berkeley Distribution August 15, 1987 MAKE(1)
All times are GMT -4. The time now is 01:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy