There is no error that throws up when running the makefile.
The following is the snippet for the ODBCSV_SO code.
/*
#include headerfiles
*/
#if defined unix || defined ODBCSV_SO
// only for libolsv2040.so
#ifdef ODBCSV_SO
/*
Code for libolsv2040.so
*/
#endif
#elif defined(ODBCSV_DLL) // only for olsv2040.dll
/*
Code for olsv2040.dll
*/
#else // only for olsv.exe
/*
Code for olsv.exe
*/
#endif
/*
Common code for all
*/
Now when I issue
make -f unix.mak libolsv
, it should make the libolsv2040.so; i.e. it should enter into the code fragment for ODBCSV_SO.
It isnt doing so. The flags are also set in the makefile. Even then the same.
Though the so is begin created, the methods in the code fragment doesnt get exported at all.
You are supplying the -D flag too late. Your rule:
$(DAEMON_SO): $(SO) *.h
$(CC) -DODBCSV_SO -shared -export-dynamic -o $(DAEMON_SO) $(SO)
@echo $(DAEMON_SO) has been built.
is taking a bunch of .o files and shoving them into a so file. The -D flag can't affect a .o file. Even if the .o file does not exist when this rule is invoked the -D flag does no good. The missing .o is generated by some other rule, perhaps a builtin.
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.
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.