From 27a2489212f9ba5ec4c7a74bc62dad0feb3cbf67 Mon Sep 17 00:00:00 2001 From: Steffen Pohle Date: Fri, 15 Sep 2023 17:52:14 +0200 Subject: [PATCH] adding Makefile --- .gitignore | 6 ---- Makefile | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 5d60970..7033506 100644 --- a/.gitignore +++ b/.gitignore @@ -50,12 +50,6 @@ m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 -# Generated Makefile -# (meta build system like autotools, -# can automatically generate from config.status script -# (which is called by configure script)) -Makefile - # ---> C++ # Prerequisites *.d diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..707e1de --- /dev/null +++ b/Makefile @@ -0,0 +1,102 @@ +.SILENT: help +VERSION = 1.0.1 + +-include Makefile.rules + +OBJECTSCLI = client.oo tcp.oo nwthread.oo + +DISTNAME=testmodbus-client-$(VERSION) + +ifeq ($(CONFIGSET),) +noconfig: help +endif + +all: Makefile.rules testmodbus-client$(TARGETEXT) + +help: + echo "set up configuration" + echo " make configwindows to generate the windows build" + echo " make configcross to generate the windows cross build" + echo " make configlinux to generate the linux build" + echo " make buildwindows to generate the build for windows (uses cross compiler)" + +configlinux: clean + cp -f Makefile.rules.linux Makefile.rules + make config + +configwindows: clean + cp -f Makefile.rules.windows Makefile.rules + make config + +configcross: clean + cp -f Makefile.rules.crosswindows Makefile.rules + make config + +config: Makefile.rules + echo "#ifndef _CONFIG_H_" > config.h + echo "#define _CONFIG_H_" >> config.h + echo "" >> config.h + echo "#define VERSION \"$(VERSION)\"" >> config.h + echo "" >> config.h + echo "#endif" >> config.h + +testmodbus-client$(TARGETEXT): $(OBJECTSCLI) + $(CPP) -o testmodbus-client$(TARGETEXT) $(OBJECTSCLI) $(LDFLAGS) $(LIBS) + +.SUFFIXES: +.SUFFIXES: .c .cc .C .cpp .oo + +.cc.oo : $(INCLUDES) + $(CPP) -o $@ -c $(CPPFLAGS) $< + +clean: + rm -rf TestModbus-Client-$(VERSION)/ + rm -f *.o *.oo *.c~ *.h~ *.cc~ *.ui~ testmodbus-client$(TARGETEXT) Makefile~ + rm -rf *.dll + rm -rf *.exe + rm -rf Makefile.rules + rm -rf test-fc16 + rm -rf test-fc15 + rm -rf config.h + +dist: clean + rm -rf $(DISTNAME) + mkdir $(DISTNAME) + cp Makefile* $(DISTNAME) + cp README.md $(DISTNAME) + cp LICENSE $(DISTNAME) + cp Changelog $(DISTNAME) + cp *.ui $(DISTNAME) + cp -rf *.h $(DISTNAME) + cp -rf *.cc $(DISTNAME) + tar cvzf $(DISTNAME).tgz $(DISTNAME) + rm -rf $(DISTNAME) + +dep: + $(CXX) -MM `ls *.cc` $(CXXFLAGS) > $(DEPENDFILE) + +buildwindows: clean + make configcross + make $(TARGET) -j 9 + make test-fc15 + make test-fc16 + mkdir TestModbus-Client-$(VERSION) + cp *.exe TestModbus-Client-$(VERSION)/ + cp testmodbus-server.ui TestModbus-Client-$(VERSION)/ + cp testmodbus-server.png TestModbus-Client-$(VERSION)/ + cp README.md TestModbus-Client-$(VERSION)/ + cp Changelog TestModbus-Client-$(VERSION)/ + cp LICENSE TestModbus-Client-$(VERSION)/ + ./copydlls.sh + ./copydlls.sh + ./copydlls.sh + ./copydlls.sh + ./copyshare.sh + mv *.dll TestModbus-Client-$(VERSION)/ + mv share TestModbus-Client-$(VERSION)/ + +-include $(DEPENDFILE) + +.PHONY: all +.PHONY: count +.PHONY: clean