changeset 46:eee0fb2bf50a

Fix building with BSD make by moving the resource logic into configure. This also allows us to skip compiling the resource object on Mac.
author Brian Smith <brian@dbsoft.org>
date Sun, 29 Nov 2020 16:48:06 -0600
parents 094b1e39c68b
children c8bed5849c76
files Makefile.in configure configure.in
diffstat 3 files changed, 35 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Sun Nov 29 04:29:31 2020 -0600
+++ b/Makefile.in	Sun Nov 29 16:48:06 2020 -0600
@@ -9,7 +9,7 @@
 MAKE = @MAKE@
 MKDIR = @MKDIR@
 INSTALL = @INSTALL@
-GRESOURCE = @GRESOURCE@
+RESOURCE = @RESOURCE@
 TARGET = dmail
 DISPLAYNAME = DynamicMail
 
@@ -32,35 +32,35 @@
 $(OBJECTS):
 	$(CC) $(CFLAGS) $(INCLUDES) -c $<
 
-resources.o:
-ifeq ($(GRESOURCE),enabled)
+gresources.o:
 	-chmod +x gtk/resources.sh
 	-gtk/resources.sh
 	$(GRC) --generate-source --target=gresources.c gtk/dmail.gresource.xml
-	$(CC) $(CFLAGS) $(INCLUDES) -c gresources.c -o resources.o
-else
+	$(CC) $(CFLAGS) $(INCLUDES) -c gresources.c
+
+resources.o:
 	$(CC) $(CFLAGS) $(INCLUDES) -c gtk/resources.c
-endif
 
-$(TARGET):  $(OBJECTS) resources.o
-	$(CC) $(CFLAGS) $(INCLUDES) -o $(TARGET) $(OBJECTS) resources.o $(LDFLAGS) $(LIBS)
+$(TARGET):  $(OBJECTS) $(RESOURCE)
+	$(CC) $(CFLAGS) $(INCLUDES) -o $(TARGET) $(OBJECTS) $(RESOURCE) $(LDFLAGS) $(LIBS)
 	-chmod +x mac/finishup.sh
 	-mac/finishup.sh "$(DISPLAYNAME)" "$(TARGET)"
 
 clean: 
 	$(RM) $(OBJECTS) resources.o dmail
-	$(RM) -rf resources/
+	$(RM) -r resources/
 
 distclean: clean
 	$(RM) *~ os2/*~ win/*~ gtk/*~ config.cache config.log config.status Makefile config.h
 
 install:
-	$(RM) -rf /usr/local/dmail
+	$(RM) -r /usr/local/dmail
 	$(MKDIR)  /usr/local/dmail
 	$(CP) -f ../config/*.typ /usr/local/dmail
 	$(INSTALL) dmail /usr/local/bin
         
-resources.o: gtk/resources.c gtk/dmail.gresource.xml
+resources.o: gtk/resources.c
+gresources.o: gtk/dmail.gresource.xml
 dmail.o: dmail.c dmail.h config.h
 backend.o: backend.c backend.h
 receive.o: receive.c sendrecv.h
--- a/configure	Sun Nov 29 04:29:31 2020 -0600
+++ b/configure	Sun Nov 29 16:48:06 2020 -0600
@@ -621,7 +621,7 @@
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
-GRESOURCE
+RESOURCE
 ARCH
 MKDIR
 MV
@@ -4064,6 +4064,17 @@
 LIBS=`dwindows-config --libs`
 CFLAGS=`dwindows-config --cflags`
 GRESOURCE=`dwindows-config --gresource`
+PLATFORM=`uname -s`
+
+if test x"$GRESOURCE" = x"enabled"; then
+  RESOURCE="gresources.o"
+else
+  RESOURCE="resources.o"
+fi
+
+if test x"$PLATFORM" = x"Darwin"; then
+  RESOURCE=""
+fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dw_main in -ldwindows" >&5
 $as_echo_n "checking for dw_main in -ldwindows... " >&6; }
--- a/configure.in	Sun Nov 29 04:29:31 2020 -0600
+++ b/configure.in	Sun Nov 29 16:48:06 2020 -0600
@@ -61,6 +61,17 @@
 LIBS=`dwindows-config --libs`
 CFLAGS=`dwindows-config --cflags`
 GRESOURCE=`dwindows-config --gresource`
+PLATFORM=`uname -s`
+
+if test x"$GRESOURCE" = x"enabled"; then
+  RESOURCE="gresources.o"
+else
+  RESOURCE="resources.o"
+fi
+
+if test x"$PLATFORM" = x"Darwin"; then
+  RESOURCE=""
+fi
 
 AC_CHECK_LIB(dwindows, dw_main,LIBS="$LIBS",AC_MSG_ERROR(Dynamic Windows library not found. DynamicMail cannot build without it.))
 
@@ -121,7 +132,7 @@
 
 AC_SUBST(ARCH)
 
-AC_SUBST(GRESOURCE)
+AC_SUBST(RESOURCE)
 
 AC_OUTPUT(Makefile:Makefile.in)
 AC_OUTPUT(minimal/Makefile:minimal/Makefile.in)