changeset 127:8baca19f709d

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:04:34 -0600
parents a7da6b5e55da
children 611aa309f033
files src/Makefile.in src/configure src/configure.in
diffstat 3 files changed, 38 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.in	Sun Nov 29 02:34:34 2020 -0600
+++ b/src/Makefile.in	Sun Nov 29 16:04:34 2020 -0600
@@ -10,7 +10,7 @@
 MKDIR = @MKDIR@
 INSTALL = @INSTALL@
 PREFIX = @prefix@
-GRESOURCE = @GRESOURCE@
+RESOURCE = @RESOURCE@
 TARGET = handyftp
 DISPLAYNAME = HandyFTP
 
@@ -33,18 +33,17 @@
 $(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/handyftp.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)"
 
@@ -53,15 +52,14 @@
 	-mac/installer.sh "$(DISPLAYNAME)" "$(TARGET)"
 	                
 clean: 
-	$(RM) $(OBJECTS) resources.o gresources.c $(TARGET)
-	$(RM) -rf resources/
+	$(RM) $(OBJECTS) resources.o gresources.c gresources.o $(TARGET)
+	$(RM) -r resources/
 
-distclean: 
-	$(RM) $(OBJECTS) resources.o gresources.c $(TARGET) *~ os2/*~ win/*~ gtk/*~ config.cache config.log config.status Makefile config.h
-	$(RM) -rf resources/
+distclean: clean
+	$(RM) *~ os2/*~ win/*~ gtk/*~ config.cache config.log config.status Makefile config.h
 
 install:
-	$(RM) -rf $(PREFIX)/share/$(TARGET)
+	$(RM) -r $(PREFIX)/share/$(TARGET)
 	$(MKDIR)  $(PREFIX)/share/$(TARGET)
 	$(CP) -f ../config/*.typ $(PREFIX)/share/$(TARGET)
 	$(CP) -f ../config/handyftp.msg $(PREFIX)/share/$(TARGET)
@@ -77,7 +75,8 @@
 	$(INSTALL) gtk/org.dbsoft.handyftp.desktop $(PREFIX)/share/applications/
 	$(INSTALL) ../readme.txt $(PREFIX)/share/$(TARGET)
         
-resources.o: gtk/resources.c gtk/handyftp.gresource.xml
+resources.o: gtk/resources.c
+gresources.o: gtk/handyftp.gresource.xml
 handyftp.o: handyftp.c handyftp.h hftpextr.h site.h config.h
 datetime.o: datetime.c datetime.h
 
--- a/src/configure	Sun Nov 29 02:34:34 2020 -0600
+++ b/src/configure	Sun Nov 29 16:04:34 2020 -0600
@@ -621,7 +621,7 @@
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
-GRESOURCE
+RESOURCE
 ARCH
 MKDIR
 MV
@@ -3908,6 +3908,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/src/configure.in	Sun Nov 29 02:34:34 2020 -0600
+++ b/src/configure.in	Sun Nov 29 16:04:34 2020 -0600
@@ -43,6 +43,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. HandyFTP cannot build without it.))
 
@@ -121,7 +132,7 @@
 
 AC_SUBST(ARCH)
 
-AC_SUBST(GRESOURCE)
+AC_SUBST(RESOURCE)
 
 AC_CONFIG_FILES([
 Makefile