add -pthread and allow make install

pull/2/head
weidai 2006-12-09 17:09:01 +00:00
parent fd0683ba19
commit e23417d90a
1 changed files with 18 additions and 1 deletions

View File

@ -6,13 +6,20 @@ CXXFLAGS = -g
# after turning on -O2. The GCC optimizer may have bugs that cause it to generate incorrect code. # after turning on -O2. The GCC optimizer may have bugs that cause it to generate incorrect code.
# Try removing -fdata-sections if you get "undefined external reference" errors. # Try removing -fdata-sections if you get "undefined external reference" errors.
# CXXFLAGS = -O2 -DNDEBUG -ffunction-sections -fdata-sections # CXXFLAGS = -O2 -DNDEBUG -ffunction-sections -fdata-sections
# LDFLAGS = -Wl,--gc-sections # LDFLAGS += -Wl,--gc-sections
ARFLAGS = -cr # ar needs the dash on OpenBSD ARFLAGS = -cr # ar needs the dash on OpenBSD
RANLIB = ranlib RANLIB = ranlib
CP = cp
MKDIR = mkdir
UNAME = $(shell uname) UNAME = $(shell uname)
ISX86 = $(shell uname -m | grep -c "i.86\|x86_64") ISX86 = $(shell uname -m | grep -c "i.86\|x86_64")
ISMINGW = $(shell uname | grep -c "MINGW32") ISMINGW = $(shell uname | grep -c "MINGW32")
# Default prefix for make install
ifeq ($(PREFIX),)
PREFIX = /usr
endif
ifeq ($(CXX),gcc) # for some reason CXX is gcc on cygwin 1.1.4 ifeq ($(CXX),gcc) # for some reason CXX is gcc on cygwin 1.1.4
CXX = g++ CXX = g++
endif endif
@ -42,6 +49,10 @@ else
CXXFLAGS += -pipe CXXFLAGS += -pipe
endif endif
ifeq ($(UNAME),Linux)
LDFLAGS += -pthread
endif
ifeq ($(UNAME),Darwin) ifeq ($(UNAME),Darwin)
AR = libtool AR = libtool
ARFLAGS = -static -o ARFLAGS = -static -o
@ -80,6 +91,12 @@ all: cryptest.exe
clean: clean:
$(RM) cryptest.exe libcryptopp.a $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS) $(RM) cryptest.exe libcryptopp.a $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
install:
$(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin
$(CP) *.h $(PREFIX)/include/cryptopp
$(CP) *.a $(PREFIX)/lib
$(CP) *.exe $(PREFIX)/bin
libcryptopp.a: $(LIBOBJS) libcryptopp.a: $(LIBOBJS)
$(AR) $(ARFLAGS) $@ $(LIBOBJS) $(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@ $(RANLIB) $@