support building a static library on Unix

This commit is contained in:
Ondřej Hošek 2012-06-30 13:54:48 +02:00
parent ad62011f36
commit 00bbde88b8
1 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,6 @@
CXX = g++ CXX = g++
AR = ar
RANLIB = ranlib
HLLIB_VERS = 2.3.0 HLLIB_VERS = 2.3.0
LDFLAGS = -shared -Wl,-soname,libhl.so.2 LDFLAGS = -shared -Wl,-soname,libhl.so.2
CXXFLAGS = -O2 -g -fpic -funroll-loops -fvisibility=hidden CXXFLAGS = -O2 -g -fpic -funroll-loops -fvisibility=hidden
@ -15,7 +17,7 @@ objs = $(sources:.cpp=.o)
.cpp.o: .cpp.o:
$(CXX) -c $(CXXFLAGS) -o $@ $< $(CXX) -c $(CXXFLAGS) -o $@ $<
all: libhl.so.$(HLLIB_VERS) all: libhl.so.$(HLLIB_VERS) libhl.a
clean: clean:
rm -f \#* *~ *.o *.so.* rm -f \#* *~ *.o *.so.*
@ -29,3 +31,7 @@ install: libhl.so.$(HLLIB_VERS)
libhl.so.$(HLLIB_VERS): $(objs) libhl.so.$(HLLIB_VERS): $(objs)
$(CXX) $(LDFLAGS) -o $@ $(objs) $(CXX) $(LDFLAGS) -o $@ $(objs)
libhl.a: $(objs)
$(AR) -rcu $@ $^
$(RANLIB) $@