Sponsored Content
Full Discussion: makefile not taking -D flags
Top Forums Shell Programming and Scripting makefile not taking -D flags Post 69941 by vino on Friday 22nd of April 2005 08:44:38 AM
Old 04-22-2005
Perderabo, you are right. I did find that out on further analysis.

A question. Is there any way I can over-ride the builtin rule for .cpp.o ?

The structure of the makefiles is as follows:

There is a universal makefile for the whole component. That in turn traverses to each of the directory inside and then calls the makefile of the respective sub-component.

Now in the universal makefile, the rules are defined for .cpp.o and other targets too.

In this particular sub-comp of DAEMON_SO, the make file is such that you do a make once to create the executables, followed by a clean and then a make for the creation of .so. So for the case of .so an extra flag -DODBCSV_SO is introduced. I wrote a rule for the OdbcSvApp.o. OdbcSvApp.cpp is responsible for the .so.


Code:
SO              = SvSocket.o SvStmt.o SvOdbcWrapper.o \
                  OdbcCallReader.o MgrCalls.o OdbcSvProxy.o

OSVAPP          = OdbcSvApp.o
OSVAPP : OdbcSvApp.cpp
        $(CC) -c $(CFLAGS) -DODBCSV_SO -o $(OSVAPP) 

$(DAEMON_SO): OdbcSvApp.o $(SO) *.h
        $(CC) -shared -export-dynamic -DODBCSV_SO -o $(DAEMON_SO) $(OSVAPP) $(SO)
        @echo $(DAEMON_SO) has been built.

Now after issuing make -f unix.mak libolsv, it all goes through peacefully. But, still -DODBCSV_OS does not get included in the rule for OdbcSvApp.cpp. Which shows, my rule is not picked up. So, how can I over-ride the builtin rule for just one cpp file.

Another way out is surely introduce another make file for the .so. But since it is a workaround I dont intend to unless it is the ONLY way out.

The following is the result output( for clarity sakes) showing the compilation statement with flags and options.
Code:
g++ -DRS_V8 -DMD5Init=OLiteMD5Init -DMD5Update=OLiteMD5Update
-DMD5Final=OLiteMD5Final -Wall -Wunused -Wno-parentheses
-Wno-sign-compare -Wno-non-virtual-dtor -Wno-reorder -DNDEBUG -O3
-fomit-frame-pointer -mcpu=pentium3 -fPIC -DOOT_SHARED_MEM  
-I/usr/java/j2sdk1.4.1_07/include -I/usr/java/j2sdk1.4.1_07/include/linux -I. 
-D_REENTRANT -DOOT_SHARED_MEM -Dboolean=char -c -o OdbcSvProxy.o 
OdbcSvProxy.cpp

gcc -shared -export-dynamic -DODBCSV_SO -o libolsv2040.so OdbcSvApp.o  
SvSocket.o SvStmt.o SvOdbcWrapper.o OdbcCallReader.o MgrCalls.o 
OdbcSvProxy.o -lpthread -lrt -lm -ldl 
-L/usr/java/j2sdk1.4.1_07/jre/lib/i386/server -ljvm 
libolsv2040.so has been built.

-v
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

if flags

Hi folks. I'm just starting to teach myself shell scripting and am having some trouble with an if statement. I am working with a directory where only one file will reside at a time and need to evaluate if this file is compressed to determine subsequent steps. I'm using echo for testing purposes.... (2 Replies)
Discussion started by: kristy
2 Replies

2. AIX

question concerning Grep flags

Hey all. I am trying to find a process that is running and appending it to a file. The comman I am using is ps -eaf |grep tctl. The problem is, it returns the tctl process as well as the grep process that I just ran. Is there a flag that will prevent the command from returning itself? ... (2 Replies)
Discussion started by: jalge2
2 Replies

3. UNIX for Advanced & Expert Users

Processes Communication Only with flags!

hello everybody and a happy new year! i am trying the client-server model...i have no problem with sockets etc... especially for server:there is a father who is listening for TCP connections from clients,the later send commands which parent shares to his children. then children execute... (1 Reply)
Discussion started by: vaggelakis
1 Replies

4. IP Networking

arp output (flags)

I'm running an arp -an on a Solaris 10 box. We're using IPMP. One of the systems is not able to see a host on the same network. The only difference between the two systems (one is having a problem, the other isn't) at least so far is the output of arp: # arp -an | grep 224.55 e1000g5... (1 Reply)
Discussion started by: BOFH
1 Replies

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

6. Shell Programming and Scripting

Need help to identify the flags by scripts.

Hi, I have two different scripts sap_ftp.sh and sap_ftp_dd.sh which are running continously in background. I am using another script called start.sh to launch these two scripts. Either one script will process files at a time . During that time other script will sleep.. Each script will... (1 Reply)
Discussion started by: bhargav20
1 Replies

7. UNIX for Dummies Questions & Answers

XLF90 Flags to PGF90

Hello, I am running into a bit of an issue running a Makefile. The problem is it was written for a xlf90 compiler when I have a pgf90 on the machine. Therefore, I keep getting errors regarding the xlf90 flags because they don't correspond with the pgf90. Here is the code: ... (0 Replies)
Discussion started by: lepagano
0 Replies

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

9. UNIX for Dummies Questions & Answers

WHat are flags?

Can anybody actually tell, what is flag? I know they are termed as permission flags and various others. Please explain (3 Replies)
Discussion started by: nixhead
3 Replies

10. UNIX for Dummies Questions & Answers

Ifconfig Flags

Hi there, I need your help in understanding the below Solaris 10 ifconfig output; athnetspns02>ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 e1000g0:... (2 Replies)
Discussion started by: wthomas
2 Replies
Mojolicious::Command::generate::makefile(3pm)		User Contributed Perl Documentation	     Mojolicious::Command::generate::makefile(3pm)

NAME
Mojolicious::Command::generate::makefile - Makefile generator command SYNOPSIS
use Mojolicious::Command::generate::makefile; my $makefile = Mojolicious::Command::generate::makefile->new; $makefile->run(@ARGV); DESCRIPTION
Mojolicious::Command::generate::makefile generates "Makefile.PL" files for applications. ATTRIBUTES
Mojolicious::Command::generate::makefile inherits all attributes from Mojo::Command and implements the following new ones. "description" my $description = $makefile->description; $makefile = $makefile->description('Foo!'); Short description of this command, used for the command list. "usage" my $usage = $makefile->usage; $makefile = $makefile->usage('Foo!'); Usage information for this command, used for the help screen. METHODS
Mojolicious::Command::generate::makefile inherits all methods from Mojo::Command and implements the following new ones. "run" $makefile->run(@ARGV); Run this command. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojolicious::Command::generate::makefile(3pm)
All times are GMT -4. The time now is 08:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy