[DVDnav-discuss] parallel make problem

Dominik 'Rathann' Mierzejewski dominik at greysector.net
Sat Aug 30 22:44:43 CEST 2008


On Saturday, 30 August 2008 at 20:20, Dominik 'Rathann' Mierzejewski wrote:
> On Saturday, 30 August 2008 at 19:56, Dominik 'Rathann' Mierzejewski wrote:
> > On Saturday, 30 August 2008 at 19:19, Dan Nicholson wrote:
> > > On Sat, Aug 30, 2008 at 10:03 AM, Dominik 'Rathann' Mierzejewski
> > > <dominik at greysector.net> wrote:
> > > > On Saturday, 30 August 2008 at 17:30, Dan Nicholson wrote:
> > > >> On Sat, Aug 30, 2008 at 7:05 AM, Dominik 'Rathann' Mierzejewski
> > > >> <dominik at greysector.net> wrote:
> > > >> > I'm experiencing a problem with make -j2:
> > > > [...]
> > > >> > But I'd rather have a proper fix instead of workarounds.
> > > >> > Ideas?
> > > >>
> > > >> You really don't want to have a target dependent on a directory
> > > >> because make will always think the target is out of date.
> > > >
> > > > On second thought, why? If it's created by that rule, it should behave
> > > > just like any other file.
> > > >
> > > >> That prevents doing the right thing:
> > > >>
> > > >> $(OBJS) $(DVDREAD_OBJS) $(SHOBJS) $(DVDREAD_SHOBJS): $(.OBJDIR)
> > > >
> > > > Actually this seems to work fine.
> > > 
> > > Run `make' again. Because the timestamp of the directory doesn't get
> > > updated, make will always think the directory is out of date. This
> > > leads to everything always been rebuilt. If that's something you can
> > > deal with, then this is the way to go.
> > 
> > Ah, I see what you mean. It wouldn't be a problem for one-time builds,
> > but it's not acceptable in general.
> > 
> > How about we drop this obj dir creation alltogether and just keep an
> > empty dir in the sources?
> > 
> > Patch attached (along with svn mkdir obj).
> 
> I've just noticed it won't work for out-of-tree builds. Maybe we could
> mkdir obj in configure(2) then?

And here's the complete patch:

-- 
Fedora http://fedoraproject.org/wiki/User:Rathann
Livna http://rpm.livna.org | MPlayer http://mplayerhq.hu
"Faith manages."
        -- Delenn to Lennier in Babylon 5:"Confessions and Lamentations"
-------------- next part --------------
Index: Makefile
===================================================================
--- Makefile	(revision 1125)
+++ Makefile	(working copy)
@@ -75,14 +75,11 @@
 
 # General targets
 
-$(.OBJDIR):
-	mkdir $(.OBJDIR)
-
-${DVDREAD_LIB}: version.h $(.OBJDIR) $(DVDREAD_OBJS) $(BUILDDEPS)
+${DVDREAD_LIB}: version.h $(DVDREAD_OBJS) $(BUILDDEPS)
 	cd $(.OBJDIR) && $(AR) rc $@ $(DVDREAD_OBJS)
 	cd $(.OBJDIR) && $(RANLIB) $@
 
-${DVDREAD_SHLIB}: version.h $(.OBJDIR) $(DVDREAD_SHOBJS) $(BUILDDEPS)
+${DVDREAD_SHLIB}: version.h $(DVDREAD_SHOBJS) $(BUILDDEPS)
 	cd $(.OBJDIR) && $(CC) $(SHLDFLAGS) $(LDFLAGS) -ldl -Wl,-soname=$(DVDREAD_SHLIB).$(SHLIB_MAJOR) -o $@ $(DVDREAD_SHOBJS)
 
 .c.so:	$(BUILDDEPS)
@@ -126,14 +123,15 @@
 # Clean targets
 
 clean:
-	rm -rf  *~ $(.OBJDIR) version.h
+	rm -rf  *~ $(.OBJDIR)/* version.h
 
 
 distclean: clean
 	find . -name "*~" | xargs rm -rf
-	rm -rf config.mak
+	rm -rf config.mak $(.OBJDIR)
 
-dvdread-config: $(.OBJDIR)
+dvdread-config: $(.OBJDIR)/dvdread-config
+$(.OBJDIR)/dvdread-config: $(BUILDDEPS)
 	@echo '#!/bin/sh' > $(.OBJDIR)/dvdread-config
 	@echo 'prefix='$(PREFIX) >> $(.OBJDIR)/dvdread-config
 	@echo 'libdir='$(shlibdir) >> $(.OBJDIR)/dvdread-config
@@ -154,7 +152,7 @@
 	-e 's, at VERSION@,$(SHLIB_VERSION),'
 
 pkgconfig: $(.OBJDIR)/dvdread.pc
-$(.OBJDIR)/dvdread.pc: misc/dvdread.pc.in $(.OBJDIR)
+$(.OBJDIR)/dvdread.pc: misc/dvdread.pc.in $(BUILDDEPS)
 	$(pcedit) $< > $@
 
 install-pkgconfig: $(.OBJDIR)/dvdread.pc
Index: configure2
===================================================================
--- configure2	(revision 1125)
+++ configure2	(working copy)
@@ -147,6 +147,8 @@
     done
 fi
 
+[ -d obj ] || mkdir -p obj
+
 echo
 echo "Done, type 'make install' to build and install"
 


More information about the DVDnav-discuss mailing list