Sponsored Content
Full Discussion: Makefile debug target
Top Forums Shell Programming and Scripting Makefile debug target Post 302275644 by JerryHone on Sunday 11th of January 2009 06:59:39 PM
Old 01-11-2009
Call the same makefile recursively in the debug target including the required flags. Don't set $(DEBUG) as a macro, but pass it in on the recursive call. Something like...

Quote:
CXX=g++
CXXFLAGS=-ansi -std=c++98 -Wall -W $(DEBUG)
# DEBUG=-g -D DEBUG
OBJS=main.o NgramCreator.o

main: $(OBJS)
$(CXX) $(OBJS) -o $@
$(OBJS): NgramCreator.h
$(CXX) $(CXXFLAGS) $(DEBUG) -c $*.cpp

debug:
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG"
HTH

Jerry
 

10 More Discussions You Might Find Interesting

1. Solaris

Makefile:57: *** multiple target patterns. Stop.

Hi, I am getting the following error while building on Solaris 64 , while I am trying to build. Error Snippet :- ---------------------- Makefile:57: *** multiple target patterns. Stop. make: Leaving directory `/work1/patch/vds6053sun64o/vobs/jvi' make: *** Error 2 make: Leaving directory... (0 Replies)
Discussion started by: nileshborate
0 Replies

2. HP-UX

Oracle 9i install: Error in invoking target install of makefile

I receive an error while installing Oracle 9i: Error in invoking target install of makefile /opt/oracle/product/9.2.0/sqlplus/lib/ins_sqlplus.mk Furthermore: $ whoami oracle $ echo $ORACLE_HOME /opt/oracle/product/9.2.0 $ pwd /opt/oracle/product/9.2.0/sqlplus/lib $ ll total... (5 Replies)
Discussion started by: chris2005
5 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. Programming

Makefile: multiple target variable substitution

Greetings! Basically, I would like to properly handle this with gnu make: alltools: my_tool mysecond_tool mythird_tool etc_tool %_tool: dir1/%_tool.vf dir2/%_tool/subdir2/%_tool.ver <tab>@echo done %.vf: <tab>RUN_VF $* %.ver: <tab>RUN_VER $* So, if I were to do something like:... (0 Replies)
Discussion started by: Harlinator
0 Replies

5. Solaris

Setting/Modifying variable specific to target in Makefile

Hi, I have a small piece of Makefile script which throw's error on Sun Sparc machine, but works fine with Sun Optron, Linux, AIX machines. FOO=Naveen test1:FOO=Dhilip test1: @echo FOO is ${FOO} test2: @echo Me is ${FOO} Output on Sun Sparc - ukhml-v890new-~/test: make test1... (5 Replies)
Discussion started by: nsriram
5 Replies

6. 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

7. Shell Programming and Scripting

MakeFile Backup Target

Goal: I'm trying to create a PHONY target inside my Makefile so that when I run the command "make backup", It will move all the files that end in "~" into the specified backup folder. Here is my code currently, and I'll explain the problem after: .PHONY: backup backup: @mkdir -p... (2 Replies)
Discussion started by: Xploit
2 Replies

8. Programming

How to define dynamic Target/Prerequisite in Makefile?

I am writing a Makefile for Cobol on Linux.My sample Makefile looks like below. I do not want to Hardcode Program names in Makefile.Is there any way we can mention directories in Target and Prerequisites instead of File names sothat Makefile Pickup all the files in mentioned path as below.... (8 Replies)
Discussion started by: kiranksb
8 Replies

9. HP-UX

After adding new iscsi target port, still the session state of that target port is showing offline

Hi, I wanted to configure new iscsi port on HPUX system, i added the target port address and configured it, once done, went to array side and searched for that host iqn number , but was nt able to find the same, came to host, then when i ran "iscsiutil -pVS" command it gave me below result ... (0 Replies)
Discussion started by: Vinay Kumar D
0 Replies

10. Programming

Makefile No rule to make target

I am trying to create a makefile to build a program and am getting the following error: make -f tsimplex.mk make: *** No rule to make target `/main/tsimplex_main.cpp', needed by `tsimplex_main.o'. Stop. OPSYS = $(shell uname -s ) TARGET = tsimplex ROOTDIR = ../../.. GTSDIR =... (1 Reply)
Discussion started by: kristinu
1 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. 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) are replaced by string2. If string1 is a single character, the parentheses are optional. 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 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 and f77(1) options, `LFLAGS' and `YFLAGS' for lex and yacc(1) options. 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 depends on the special name `.PRECIOUS'. Other options: -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) 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. MAKE(1)
All times are GMT -4. The time now is 07:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy