Guys, would you describe a few things about c++ building blocks, on unix.
I want to create an application that links against static libs and dynamic libs (.so).
<
Bare bones Makefile for creating a static library consisting of the code in foo.cpp, bar.cpp:
PROJECT = library.a
OBJECTS = foo.o bar.o
CFLAGS = -Wall -pedantic
all: $(PROJECT)
.cpp.o:
g++ -c $(CFLAGS) $<
$(PROJECT): $(OBJECTS)
libtool -o $(PROJECT) -static $(OBJECTS)
Bare bones Makefile for an app baz.cpp that static links to library.a:
PROJECT = baz
CFLAGS = -Wall -pedantic
OBJECTS = baz.o
all: $(PROJECT)
.cpp.o:
g++ -c $(CFLAGS) $<
$(PROJECT): $(OBJECTS) library.a
g++ $(OBJECTS) -L. -llibrary -o $(PROJECT)
Dynamic library left, ahem, as an exercise to the reader.