Skip to content

Commit

Permalink
fix compilation for modern Windows system
Browse files Browse the repository at this point in the history
  • Loading branch information
gmfcd128 committed Jul 22, 2024
1 parent a092855 commit 1af5ea0
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 49 deletions.
93 changes: 46 additions & 47 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
#
# snmpb project top-level makefile. Supports Linux, MacOSX, NetBSD & Cygwin/Windows
#

# Copyright (C) 2004-2017 Martin Jolicoeur (snmpb1@gmail.com)
#

# This file is part of the SnmpB project
# (http://sourceforge.net/projects/snmpb)
#

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
os:=$(shell uname -s)

WINQT_PREFIX=/mingw64/qt5-static/bin/
os := $(shell uname -s)

WINQT_PREFIX = /mingw64/qt5-static/bin/

ifneq ($(findstring BSD,${os}),)
INSTALL=install
SHARE=share
ifneq ($(findstring BSD,$(os)),)
INSTALL = install
SHARE = share
else
INSTALL=install -v
SHARE=share/apps
INSTALL = install -v
SHARE = share/apps
endif

ifndef INSTALL_PREFIX
INSTALL_PREFIX=/usr/local
INSTALL_PREFIX = /usr/local
endif

ifndef BIN_PREFIX
BIN_PREFIX=bin
BIN_PREFIX = bin
endif

ifndef NO_ROOT
ROOT_OWNER="--owner=root"
ROOT_OWNER = --owner=root
endif

ifdef QTBIN
QMAKE=${QTBIN}/qmake
QMAKE = $(QTBIN)/qmake
else
QMAKE=qmake
QMAKE = qmake
endif

ifneq ($(findstring MINGW,${os}),)
QMAKE=${WINQT_PREFIX}${QMAKE}
ifneq ($(findstring MINGW,$(os)),)
QMAKE = $(WINQT_PREFIX)qmake
endif

all: snmpb

ifneq ($(findstring MINGW,${os}),)
LIBSMI=libsmi/win/libsmi.a
ifneq ($(findstring MINGW,$(os)),)
LIBSMI = libsmi/win/libsmi.a
else
LIBSMI=libsmi/lib/.libs/libsmi.a
LIBSMI = libsmi/lib/.libs/libsmi.a
endif

libtomcrypt/libtomcrypt.a:
$(MAKE) -C libtomcrypt

libsmi/win/libsmi.a:
$(MAKE) -C libsmi/win -f Makefile.mingw libs

libsmi/lib/.libs/libsmi.a: libsmi/Makefile
$(MAKE) -C libsmi

libsmi/Makefile:
ifneq ($(findstring Darwin,${os}),)
ifneq ($(findstring Darwin,$(os)),)
# MacOSX
cd libsmi; ./configure --disable-shared --disable-yang --with-pathseparator=';' --with-dirseparator='/' --with-smipath='/Applications/SnmpB.app/Contents/MacOS/mibs;/Applications/SnmpB.app/Contents/MacOS/pibs'
else
# Linux/BSD
cd libsmi; ./configure --disable-shared --disable-yang --with-pathseparator=';' --with-dirseparator='/' --with-smipath=${INSTALL_PREFIX}'/${SHARE}/snmpb/mibs;'${INSTALL_PREFIX}'/${SHARE}/snmpb/pibs'
cd libsmi; ./configure --disable-shared --disable-yang --with-pathseparator=';' --with-dirseparator='/' --with-smipath=$(INSTALL_PREFIX)/$(SHARE)/snmpb/mibs;$(INSTALL_PREFIX)/$(SHARE)/snmpb/pibs
endif

qwt/lib/libqwt.a: qwt/Makefile
$(MAKE) -C qwt

qwt/Makefile:
cd qwt; ${QMAKE} qwt.pro
cd qwt; $(QMAKE) qwt.pro

app/makefile.snmpb:
cd app; ${QMAKE} -o makefile.snmpb snmpb.pro
cd app; $(QMAKE) -o makefile.snmpb snmpb.pro

app/snmpb: app/makefile.snmpb
$(MAKE) -C app -f makefile.snmpb
Expand All @@ -97,7 +97,7 @@ snmpb: libtomcrypt/libtomcrypt.a \

clean: app/makefile.snmpb
-$(MAKE) -C libtomcrypt clean
ifneq ($(findstring MINGW,${os}),)
ifneq ($(findstring MINGW,$(os)),)
-$(MAKE) -C libsmi/win -f Makefile.mingw clean
else
-$(MAKE) -C libsmi clean
Expand All @@ -106,35 +106,34 @@ endif
-$(MAKE) -C app -f makefile.snmpb clean

distclean: clean
ifneq ($(findstring MINGW,${os}),)
ifneq ($(findstring MINGW,$(os)),)
-$(MAKE) -C libsmi/win -f Makefile.mingw distclean
else
-$(MAKE) -C libsmi distclean
endif
-$(MAKE) -C qwt distclean

maintainer-clean: clean
ifneq ($(findstring MINGW,${os}),)
ifneq ($(findstring MINGW,$(os)),)
-$(MAKE) -C libsmi/win -f Makefile.mingw maintainer-clean
else
-$(MAKE) -C libsmi maintainer-clean
endif
-$(MAKE) -C qwt distclean

install:
$(INSTALL) -d ${INSTALL_PREFIX}/${BIN_PREFIX} ${INSTALL_PREFIX}/${SHARE}/snmpb/mibs ${INSTALL_PREFIX}/${SHARE}/snmpb/pibs
$(INSTALL) -m 4755 -D -s ${ROOT_OWNER} app/snmpb ${INSTALL_PREFIX}/${BIN_PREFIX}
$(INSTALL) -m 444 ${ROOT_OWNER} libsmi/mibs/iana/* ${INSTALL_PREFIX}/${SHARE}/snmpb/mibs
$(INSTALL) -m 444 ${ROOT_OWNER} libsmi/mibs/ietf/* ${INSTALL_PREFIX}/${SHARE}/snmpb/mibs
$(INSTALL) -m 444 ${ROOT_OWNER} libsmi/mibs/tubs/* ${INSTALL_PREFIX}/${SHARE}/snmpb/mibs
$(INSTALL) -m 444 ${ROOT_OWNER} libsmi/pibs/ietf/* ${INSTALL_PREFIX}/${SHARE}/snmpb/pibs
$(INSTALL) -m 444 ${ROOT_OWNER} libsmi/pibs/tubs/* ${INSTALL_PREFIX}/${SHARE}/snmpb/pibs
rm -f ${INSTALL_PREFIX}/${SHARE}/snmpb/mibs/Makefile* ${INSTALL_PREFIX}/${SHARE}/snmpb/pibs/Makefile*
$(INSTALL) -d ${INSTALL_PREFIX}/share/applications ${INSTALL_PREFIX}/share/mime/packages
$(INSTALL) -m 444 ${ROOT_OWNER} app/snmpb.desktop ${INSTALL_PREFIX}/share/applications
$(INSTALL) -m 444 ${ROOT_OWNER} app/snmpb.xml ${INSTALL_PREFIX}/share/mime/packages
$(INSTALL) -d ${INSTALL_PREFIX}/share/icons/hicolor/128x128/apps ${INSTALL_PREFIX}/share/pixmaps ${INSTALL_PREFIX}/share/icons/hicolor/scalable/apps
$(INSTALL) -m 444 ${ROOT_OWNER} app/images/snmpb.png ${INSTALL_PREFIX}/share/icons/hicolor/128x128/apps
$(INSTALL) -m 444 ${ROOT_OWNER} app/images/snmpb.png ${INSTALL_PREFIX}/share/pixmaps
$(INSTALL) -m 444 ${ROOT_OWNER} app/images/snmpb.svg ${INSTALL_PREFIX}/share/icons/hicolor/scalable/apps

$(INSTALL) -d $(INSTALL_PREFIX)/$(BIN_PREFIX) $(INSTALL_PREFIX)/$(SHARE)/snmpb/mibs $(INSTALL_PREFIX)/$(SHARE)/snmpb/pibs
$(INSTALL) -m 4755 -D -s $(ROOT_OWNER) app/snmpb $(INSTALL_PREFIX)/$(BIN_PREFIX)
$(INSTALL) -m 444 $(ROOT_OWNER) libsmi/mibs/iana/* $(INSTALL_PREFIX)/$(SHARE)/snmpb/mibs
$(INSTALL) -m 444 $(ROOT_OWNER) libsmi/mibs/ietf/* $(INSTALL_PREFIX)/$(SHARE)/snmpb/mibs
$(INSTALL) -m 444 $(ROOT_OWNER) libsmi/mibs/tubs/* $(INSTALL_PREFIX)/$(SHARE)/snmpb/mibs
$(INSTALL) -m 444 $(ROOT_OWNER) libsmi/pibs/ietf/* $(INSTALL_PREFIX)/$(SHARE)/snmpb/pibs
$(INSTALL) -m 444 $(ROOT_OWNER) libsmi/pibs/tubs/* $(INSTALL_PREFIX)/$(SHARE)/snmpb/pibs
rm -f $(INSTALL_PREFIX)/$(SHARE)/snmpb/mibs/Makefile* $(INSTALL_PREFIX)/$(SHARE)/snmpb/pibs/Makefile*
$(INSTALL) -d $(INSTALL_PREFIX)/share/applications $(INSTALL_PREFIX)/share/mime/packages
$(INSTALL) -m 444 $(ROOT_OWNER) app/snmpb.desktop $(INSTALL_PREFIX)/share/applications
$(INSTALL) -m 444 $(ROOT_OWNER) app/snmpb.xml $(INSTALL_PREFIX)/share/mime/packages
$(INSTALL) -d $(INSTALL_PREFIX)/share/icons/hicolor/128x128/apps $(INSTALL_PREFIX)/share/pixmaps $(INSTALL_PREFIX)/share/icons/hicolor/scalable/apps
$(INSTALL) -m 444 $(ROOT_OWNER) app/images/snmpb.png $(INSTALL_PREFIX)/share/icons/hicolor/128x128/apps
$(INSTALL) -m 444 $(ROOT_OWNER) app/images/snmpb.png $(INSTALL_PREFIX)/share/pixmaps
$(INSTALL) -m 444 $(ROOT_OWNER) app/images/snmpb.svg $(INSTALL_PREFIX)/share/icons/hicolor/scalable/apps
2 changes: 1 addition & 1 deletion libsmi/lib/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void smiFree(void *ptr)

int smiIsPath(const char *s)
{
return (/*strchr(s, '.') ||*/ strchr(s, DIR_SEPARATOR));
return (strchr(s, DIR_SEPARATOR) != NULL);
}


Expand Down
1 change: 1 addition & 0 deletions qwt/src/qwt_graphic.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <qmetatype.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qpainterpath.h>

class QwtPainterCommand;

Expand Down
1 change: 1 addition & 0 deletions qwt/src/qwt_null_paintdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "qwt_global.h"
#include <qpaintdevice.h>
#include <qpaintengine.h>
#include <qpainterpath.h>

/*!
\brief A null paint device doing nothing
Expand Down
1 change: 1 addition & 0 deletions qwt/src/qwt_painter.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <qpen.h>
#include <qline.h>
#include <qpalette.h>
#include <qpainterpath.h>

class QPainter;
class QBrush;
Expand Down
2 changes: 1 addition & 1 deletion qwt/src/qwt_painter_command.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <qpixmap.h>
#include <qimage.h>
#include <qpolygon.h>

#include <qpainterpath.h>
class QPainterPath;

/*!
Expand Down

0 comments on commit 1af5ea0

Please sign in to comment.