changeset 343:5e3b880dd2fc

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:22:18 -0600
parents f00bc5c00090
children 2532434a7209
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 03:31:04 2020 -0600
+++ b/Makefile.in	Sun Nov 29 16:22:18 2020 -0600
@@ -8,7 +8,7 @@
 MKDIR = @MKDIR@
 INSTALL = @INSTALL@
 PREFIX = @prefix@
-GRESOURCE = @GRESOURCE@
+RESOURCE = @RESOURCE@
 TARGET = @TARGET@
 SOSUFFIX=	@SOSUFFIX@
 SONAME=	@SONAME@
@@ -73,18 +73,17 @@
 $(OBJECTS):
 	$(CC) $(CFLAGS) -DDW_RESOURCES $(INCLUDES) -c $<
 
-resources.o:
-ifeq ($(GRESOURCE),enabled)
+gresources.o:
 	-chmod +x gtk/resources.sh
 	-gtk/resources.sh
 	$(GRC) --generate-source --target=gresources.c gtk/dwib.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) -DDW_RESOURCES $(INCLUDES) -o $(TARGET) $(OBJECTS) resources.o $(LDFLAGS) $(LIBS)
+$(TARGET):  $(OBJECTS) $(RESOURCE)
+	$(CC) $(CFLAGS) -DDW_RESOURCES $(INCLUDES) -o $(TARGET) $(OBJECTS) $(RESOURCE) $(LDFLAGS) $(LIBS)
 	-chmod +x mac/finishup.sh
 	-mac/finishup.sh "$(DISPLAYNAME)" "$(TARGET)"
 
@@ -98,8 +97,8 @@
 	-mac/installer.sh "$(DISPLAYNAME)" "$(TARGET)"
 
 clean:
-	$(RM) $(OBJECTS) resources.o gresources.c $(TARGET) example example.o *.$(SOSUFFIX) *.$(SOSUFFIX).* *~
-	$(RM) -rf resources/
+	$(RM) $(OBJECTS) resources.o gresources.c gresources.o $(TARGET) example example.o *.$(SOSUFFIX) *.$(SOSUFFIX).* *~
+	$(RM) -r resources/
 
 distclean: clean
 	$(RM) os2/*~ win/*~ gtk/*~ config.cache config.log config.status Makefile config.h
@@ -123,7 +122,8 @@
 	ln -sf $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).$(SOSUFFIX); \
 	ln -sf $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).$(SOSUFFIX).$(VER_MAJ)
 
-resources.o: gtk/resources.c gtk/dwib.gresource.xml
+resources.o: gtk/resources.c
+gresources.o: gtk/dwib.gresource.xml
 dwib.o: dwib.c dwib.h dwib_int.h resources.h config.h
 dwib_lib.o: dwib_lib.c dwib.h dwib_int.h config.h
 
--- a/configure	Sun Nov 29 03:31:04 2020 -0600
+++ b/configure	Sun Nov 29 16:22:18 2020 -0600
@@ -621,7 +621,7 @@
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
-GRESOURCE
+RESOURCE
 ARCH
 TARGET
 SONAME
@@ -3854,6 +3854,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 03:31:04 2020 -0600
+++ b/configure.in	Sun Nov 29 16:22:18 2020 -0600
@@ -47,6 +47,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. Interface Builder cannot build without it.))
 
@@ -139,6 +150,6 @@
 
 AC_SUBST(ARCH)
 
-AC_SUBST(GRESOURCE)
+AC_SUBST(RESOURCE)
 
 AC_OUTPUT(Makefile:Makefile.in dwib-config1 dwib1.pc)