You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libUDPTCPNetwork/Makefile.win

109 lines
2.4 KiB

# .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
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
DEFAULT_TCPPORT=6131
DEFAULT_UDPPORT=6131
DEFAULT_SERVER=localhost
OBJLIB=network.o udp.o tcp.o unix.o ssl.o
INCLIB=config.h UDPTCPNetwork.h
OBJLIB_NAME=UDPTCPNetwork
TARGET=UDPTCPNetwork.dll
DISTNAME=libUDPTCPNetwork-$(VERSION)
DEPENDFILE=.depend
all: dep $(TARGET) test-udp test-tcp test-ssl
test-tcp: $(TARGET) test-tcp.o config.h
$(CXX) test-tcp.o -o $@ -lUDPTCPNetwork -L./ -I./ $(LDFLAGS)
test-ssl: $(TARGET) test-ssl.o config.h
$(CXX) test-ssl.o -o $@ -lUDPTCPNetwork -L./ -I./ $(LDFLAGS)
test-udp: $(TARGET) test-udp.o config.h
$(CXX) test-udp.o -o $@ -lUDPTCPNetwork -L./ -I./ $(LDFLAGS)
keygen:
# openssl req -nodes -new -newkey rsa:2048 -sha256 -out csr.pem -keyout privkey.pem
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privkey.pem -out cert.pem
install: $(TARGET)
cp -f $(TARGET) $(PREFIX)/lib/
cp -f UDPTCPNetwork.h $(PREFIX)/include/
uninstall:
rm -f $(PREFIX)/lib/$(TARGET)
rm -f $(PREFIX)/lib/lib$(OBJLIB_NAME).so
rm -f $(PREFIX)/include/UDPTCPNetwork.h
rebuild: clean all
$(TARGET): $(OBJLIB) $(INCLIB)
$(CXX) -shared $(LINKPARAMS) -o $(TARGET) $^ $(LDFLAGS)
ln -sf $(TARGET) lib$(OBJLIB_NAME).so
ar rcs lib$(OBJLIB_NAME).a $(OBJLIB)
dep:
$(CXX) -MM `ls *.cc` $(CXXFLAGS) > $(DEPENDFILE)
clean:
rm test-tcp -rf
rm test-udp -rf
rm test-ssl -rf
rm -rf gmon.out
rm *.s -rf
rm *.a -rf
rm -rf *.dll
rm *.o -rf
rm *.oo -rf
rm *~ -rf
rm -rf config.h
rm -rf .depend
rm -rf *.so
rm -rf *.a
rm -rf *.so.*
rm -rf *.pem -rf
cleanall: clean
source: cleanall
config:
echo "#ifndef _CONFIG_H_" > config.h
echo "#define _CONFIG_H_" >> config.h
echo "" >> config.h
echo "#define UDPTCPNETWORK_VERSION \"$(VERSION)\"" >> config.h
echo "" >> config.h
echo "#define PREFIX \"$(PREFIX)\"" >> config.h
echo "#define ETCPREFIX \"$(ETCPREFIX)\"" >> config.h
echo "" >> config.h
echo "#endif" >> config.h
dist: clean
mkdir -p $(DISTNAME)
cp -rf Makefile $(DISTNAME)
cp -rf *.h $(DISTNAME)
cp -rf *.cc $(DISTNAME)
tar cvzf $(DISTNAME).tgz --exclude=*/CVS/* --exclude=*/CVS/ $(DISTNAME)
rm -rf $(DISTNAME)
-include $(DEPENDFILE)