I am quite happily compiling small C++/C executables by:
i) not using a Makefile: -f /dev/null;
ii) setting builtin variables accordingly

Example:

make -f /dev/null LOADLIBES="-L${HOME}/lib64 -L." \
LDLIBS=" $(pkg-config --libs-only-l glibmm2.4)" \
CFLAGS="-ggdb3" \
CXXFLAGS="-gdwarf-2  -Wall $(pkg-config --cflags glibmm2.4)" \
CPPFLAGS="$(pkg-config --cflags glibmm2.4) -m64 -mtune=generic -O0 -I." \
some_code.cpp

Is it possible to the same for but for a SO library (-shared -fPIC)?

I have experimented but decided its not so have created a basic Makefile:
=======================================
LINK.so = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
# environment
SUFFIXES := .out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s
.S .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo .w .ch .web .sh
.elc .el .so

# Implicit Rules

%.so: %.o
    #  recipe to build so:
        $(LINK.so) $^ $(LOADLIBES) $(LDLIBS) -shared -o lib$@.so

=======================================

So far, though, its a no-go .

Has anyone else tried and succeeded to do this?

I am using:
GNU Make 3.82
gcc 4.6.3

-- 
Giles Anderson
_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to