Add the necessary makefile magic for compiling on cygwin

This also works with make install (thanks to rpath).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1351 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-01-26 19:57:34 +00:00
parent 177a5d24db
commit 432a04e545
4 changed files with 51 additions and 11 deletions
+24 -6
View File
@@ -16,26 +16,40 @@ CXX := @CXX@
CXXFLAGS := @CPPFLAGS@ @CXXFLAGS@
LDFLAGS := @LDFLAGS@
LIBS := @LIBS@
LIBZNC := @LIBZNC@
LIBZNCDIR:= @LIBZNCDIR@
SRCS := ZNCString.cpp Csocket.cpp main.cpp znc.cpp User.cpp IRCSock.cpp Client.cpp DCCBounce.cpp \
LIB_SRCS := ZNCString.cpp Csocket.cpp znc.cpp User.cpp IRCSock.cpp Client.cpp DCCBounce.cpp \
DCCSock.cpp Chan.cpp Nick.cpp Server.cpp Modules.cpp MD5.cpp Buffer.cpp Utils.cpp \
FileUtils.cpp HTTPSock.cpp Template.cpp ClientCommand.cpp
OBJS := $(patsubst %cpp,%o,$(SRCS))
CLEAN := znc *.o core core.*
BIN_SRCS := main.cpp
LIB_OBJS := $(patsubst %cpp,%o,$(LIB_SRCS))
BIN_OBJS := $(patsubst %cpp,%o,$(BIN_SRCS))
CLEAN := znc *.o core core.*
DISTCLEAN := Makefile config.log config.status znc-config znc-buildmod .depend \
modules/.depend modules/Makefile man/Makefile
.PHONY: all man modules clean distclean install
all: znc man @MODTARGET@
all: znc man @MODTARGET@ $(LIBZNC)
ifeq "$(LIBZNC)" ""
OBJS := $(BIN_OBJS) $(LIB_OBJS)
znc: $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
else
znc: $(BIN_OBJS) $(LIBZNC)
$(CXX) $(LDFLAGS) -o $@ $(BIN_OBJS) -L. -lznc -Wl,-rpath,$(LIBZNCDIR) $(LIBS)
$(LIBZNC): $(LIB_OBJS)
$(CXX) $(LDFLAGS) -shared -o $@ $(LIB_OBJS) $(LIBS)
endif
man:
@$(MAKE) -C man
modules:
modules: $(LIBZNC)
@if test -n "@MODTARGET@"; then \
$(MAKE) -C modules; \
else \
@@ -56,13 +70,17 @@ distclean: clean
@mkdir -p .depend
$(CXX) $(CXXFLAGS) -c -o $@ $< -MMD -MF .depend/$@.dep
install: znc
install: znc $(LIBZNC)
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(includedir)/znc
install -m 0755 znc $(DESTDIR)$(bindir)
install -m 0755 znc-config $(DESTDIR)$(bindir)
install -m 0755 znc-buildmod $(DESTDIR)$(bindir)
install -m 0644 $(srcdir)/*.h $(DESTDIR)$(includedir)/znc
@if test -n "$(LIBZNC)"; then \
mkdir -p $(DESTDIR)$(LIBZNCDIR) ; \
install -m 0755 $(LIBZNC) $(DESTDIR)$(LIBZNCDIR) ; \
fi
@if test -n "@MODTARGET@"; then \
$(MAKE) -C modules install DESTDIR=$(DESTDIR); \
fi
Vendored
+13 -3
View File
@@ -631,6 +631,8 @@ host_vendor
host_os
PERL
MODFLAGS
LIBZNC
LIBZNCDIR
MODLINK
MODTARGET
NOSSL
@@ -3059,10 +3061,14 @@ echo "$as_me: error: could not find dlopen. Try --disable-modules" >&2;}
appendMod -mimpure-text
fi
# cygwin doesn't know -fPIC, everything else needs it (for modules)
# warning: -fPIC ignored for target (all code is position independent)
if test -z "$ISCYGWIN" ; then
# cygwin doesn't need -fPIC, everything else does (for modules)
# warning: -fPIC ignored for target (all code is position independent)
appendMod -fPIC
else
# But cygwin does want most of znc in a shared lib
LIBZNC="libznc.dll"
LIBZNCDIR="$libdir/znc"
fi
if test -z "$ISDARWIN"; then
@@ -3285,6 +3291,8 @@ VERSION=0.063
ac_config_files="$ac_config_files Makefile"
ac_config_files="$ac_config_files znc-config"
@@ -3983,6 +3991,8 @@ host_vendor!$host_vendor$ac_delim
host_os!$host_os$ac_delim
PERL!$PERL$ac_delim
MODFLAGS!$MODFLAGS$ac_delim
LIBZNC!$LIBZNC$ac_delim
LIBZNCDIR!$LIBZNCDIR$ac_delim
MODLINK!$MODLINK$ac_delim
MODTARGET!$MODTARGET$ac_delim
NOSSL!$NOSSL$ac_delim
@@ -3994,7 +4004,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 63; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 65; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+8 -2
View File
@@ -177,10 +177,14 @@ if test "$MODULES" = "yes"; then
appendMod -mimpure-text
fi
# cygwin doesn't know -fPIC, everything else needs it (for modules)
# warning: -fPIC ignored for target (all code is position independent)
if test -z "$ISCYGWIN" ; then
# cygwin doesn't need -fPIC, everything else does (for modules)
# warning: -fPIC ignored for target (all code is position independent)
appendMod -fPIC
else
# But cygwin does want most of znc in a shared lib
LIBZNC="libznc.dll"
LIBZNCDIR="$libdir/znc"
fi
if test -z "$ISDARWIN"; then
@@ -222,6 +226,8 @@ AC_SUBST([CPPFLAGS])
AC_SUBST([MODFLAGS])
AC_SUBST([LDFLAGS])
AC_SUBST([LIBS])
AC_SUBST([LIBZNC])
AC_SUBST([LIBZNCDIR])
AC_SUBST([MODLINK])
AC_SUBST([MODTARGET])
AC_SUBST([NOSSL])
+6
View File
@@ -22,6 +22,12 @@ LDFLAGS := @LDFLAGS@
PERL := @PERL@
MODDIR := @MODDIR@
DATADIR := @DATADIR@
LIBZNC := @LIBZNC@
LIBZNCDIR:= @LIBZNCDIR@
ifneq "$(LIBZNC)" ""
LDFLAGS += -L.. -lznc -Wl,-rpath,$(LIBZNCDIR)
endif
FILES := $(basename $(wildcard $(srcdir)/*.cpp))
# Strip away the srcdir, we want them to be created in the current dir