update windows build

master
steffen 5 years ago
parent 1b795fdb6b
commit d4b300f576

@ -1,37 +1,41 @@
# .SILENT: .SILENT: help
VERSION=0.1 VERSION=0.1
PREFIX=/usr/local OBJLIB_NAME=UDPTCPNetwork
ETCPREFIX=/etc
# WINLIBS=-lwsock32 -lws2_32
CXX=g++ -include Makefile.rules
CXXFLAGS= -ggdb -fPIC -pg -Wno-write-strings -I./ -std=c++11
# LDFLAGS= -lm -lc -pg -lssl -lcrypto $(WINLIBS)
LDFLAGS= -lm -pg -lssl -lcrypto $(WINLIBS)
DEFAULT_TCPPORT=6131 DEFAULT_TCPPORT=6131
DEFAULT_UDPPORT=6131 DEFAULT_UDPPORT=6131
DEFAULT_SERVER=localhost DEFAULT_SERVER=localhost
OBJLIB=network.o udp.o tcp.o unix.o ssl.o OBJLIB=network.o udp.o tcp.o unix.o ssl.o
INCLIB=config.h UDPTCPNetwork.h INCLIB=UDPTCPNetwork.h
OBJLIB_NAME=UDPTCPNetwork
TARGET=lib$(OBJLIB_NAME).so.$(VERSION) ifeq ($(TARGET),)
noconfig: help
endif
DISTNAME=libUDPTCPNetwork-$(VERSION)
DEPENDFILE=.depend
all: dep $(TARGET) test-udp test-tcp test-ssl all: dep $(TARGET) test-udp test-tcp test-ssl
test-tcp: $(TARGET) test-tcp.o config.h help:
echo "set up configuration"
echo " make configwindows to generate the windows build"
echo " make configlinux to generate the linix build"
configlinux: clean
cp -f Makefile.rules.linux Makefile.rules
configwindows: clean
cp -f Makefile.rules.windows Makefile.rules
test-tcp: $(TARGET) test-tcp.o
$(CXX) test-tcp.o -o $@ -lUDPTCPNetwork -L./ -I./ $(LDFLAGS) $(CXX) test-tcp.o -o $@ -lUDPTCPNetwork -L./ -I./ $(LDFLAGS)
test-ssl: $(TARGET) test-ssl.o config.h test-ssl: $(TARGET) test-ssl.o
$(CXX) test-ssl.o -o $@ -lUDPTCPNetwork -L./ -I./ $(LDFLAGS) $(CXX) test-ssl.o -o $@ -lUDPTCPNetwork -L./ -I./ $(LDFLAGS)
test-udp: $(TARGET) test-udp.o config.h test-udp: $(TARGET) test-udp.o
$(CXX) test-udp.o -o $@ -lUDPTCPNetwork -L./ -I./ $(LDFLAGS) $(CXX) test-udp.o -o $@ -lUDPTCPNetwork -L./ -I./ $(LDFLAGS)
keygen: keygen:
@ -40,9 +44,9 @@ keygen:
install: $(TARGET) install: $(TARGET)
cp -f $(TARGET) $(PREFIX)/lib/ cp -f $(TARGET) $(PREFIX)/lib/
ln -sf $(TARGET) $(PREFIX)/lib/lib$(OBJLIB_NAME).so if test -f "lib$(OBJLIB_NAME).so"; then cp -f lib$(OBJLIB_NAME).so $(PREFIX)/lib/ ; fi
cp -f UDPTCPNetwork.h $(PREFIX)/include/ cp -f UDPTCPNetwork.h $(PREFIX)/include/
uninstall: uninstall:
rm -f $(PREFIX)/lib/$(TARGET) rm -f $(PREFIX)/lib/$(TARGET)
rm -f $(PREFIX)/lib/lib$(OBJLIB_NAME).so rm -f $(PREFIX)/lib/lib$(OBJLIB_NAME).so
@ -51,15 +55,15 @@ uninstall:
rebuild: clean all rebuild: clean all
$(TARGET): $(OBJLIB) $(INCLIB) $(TARGET): $(OBJLIB) $(INCLIB)
# $(CXX) -shared -Wl,-soname,lib$(OBJLIB_NAME).so -o $(TARGET) $^ -lc $(LDFLAGS) $(CXX) -shared $(LINKPARAMS) -o $(TARGET) $^ $(LDFLAGS)
$(CXX) -shared -Wl,-soname,lib$(OBJLIB_NAME).so -o $(TARGET) $^ $(LDFLAGS) if test -f "lib$(OBJLIB_NAME).so.$(VERSION)"; then ln -sf $(TARGET) lib$(OBJLIB_NAME).so; fi
ln -sf $(TARGET) lib$(OBJLIB_NAME).so
ar rcs lib$(OBJLIB_NAME).a $(OBJLIB) ar rcs lib$(OBJLIB_NAME).a $(OBJLIB)
dep: dep:
$(CXX) -MM `ls *.cc` $(CXXFLAGS) > $(DEPENDFILE) $(CXX) -MM `ls *.cc` $(CXXFLAGS) > $(DEPENDFILE)
clean: clean:
rm Makefile.rules -rf
rm test-tcp -rf rm test-tcp -rf
rm test-udp -rf rm test-udp -rf
rm test-ssl -rf rm test-ssl -rf
@ -75,11 +79,6 @@ clean:
rm -rf *.dll rm -rf *.dll
rm -rf *.so.* rm -rf *.so.*
rm -rf *.pem -rf rm -rf *.pem -rf
cleanall: clean
source: cleanall
config: config:
echo "#ifndef _CONFIG_H_" > config.h echo "#ifndef _CONFIG_H_" > config.h

@ -0,0 +1,16 @@
PREFIX = /usr/local
ETCPREFIX = /etc
LINUXVERSION = 1
CXX = g++
CXXFLAGS = -ggdb -fPIC -pg -Wno-write-strings -I./ -std=c++11 -DBUILD_LINUX
LDFLAGS = -lm -pg -lssl -lcrypto
TARGET = lib$(OBJLIB_NAME).so.$(VERSION)
DISTNAME = lib$(OBJLIB_NAME)-$(VERSION)
DEPENDFILE = .depend
LINKPARAMS = -Wl,-soname,lib$(OBJLIB_NAME).so

@ -0,0 +1,14 @@
VERSION = 0.1
PREFIX = /usr
ETCPREFIX = /etc
WINVERSION = 1
CXX = g++
CXXFLAGS = -ggdb -fPIC -Wno-write-strings -I./ -std=c++11 -DBUILD_WINDOWS
LDFLAGS = -lm -lssl -lcrypto -lwsock32 -lws2_32
TARGET = $(OBJLIB_NAME).dll
DISTNAME = lib$(OBJLIB_NAME)-$(VERSION)
DEPENDFILE = .depend
LINKPARAMS = -Wl,--out-implib,libUDPTCPNetwork.a

@ -1,4 +1,12 @@
# .SILENT: # .SILENT:
#
# to build the windows version please install MSYS2
#
# this file should not been used anymore use make configwindows; make ; make install instead
#
#
VERSION=0.1 VERSION=0.1
PREFIX=/usr PREFIX=/usr

Loading…
Cancel
Save