Sunday, December 04, 2011

Static link build Makefile example

Static link build Makefile example

objects = vgalib.o

all = libvga.a vga

all: $(all)

%.o: %.cpp
 $(CXX) -c -o $@ $<

vga: vga.cpp libvga.a
 $(CXX) -static -o $@ $^ /usr/lib/libx86.a
 strip $@

libvga.a: $(objects)
 $(AR) -rs $@ $^

clean:
 rm -f $(objects) $(all)

No comments: