From: Jeremy H. <jer...@fr...> - 2010-04-01 19:55:03
|
This helps debugging on darwin. Signed-off-by: Jeremy Huddleston <jer...@ap...> --- progs/xdemos/Makefile | 45 +++++++++++++++------------------------------ 1 files changed, 15 insertions(+), 30 deletions(-) diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile index d5c627a..29cba0c 100644 --- a/progs/xdemos/Makefile +++ b/progs/xdemos/Makefile @@ -53,17 +53,18 @@ EXTRA_PROGS = \ ##### RULES ##### -.SUFFIXES: -.SUFFIXES: .c +.o: $(LIB_DEP) + $(APP_CC) $(LDFLAGS) $< $(LIBS) -o $@ -.c: $(LIB_DEP) - $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ +.c.o: + $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $< -c -o $@ ##### TARGETS ##### default: $(PROGS) +$(PROGS): $(PROGS:%=%.o) extra: $(EXTRA_PROGS) @@ -74,45 +75,29 @@ clean: # special cases +pbutil.o: pbutil.h +pbinfo.o: pbutil.h pbinfo: pbinfo.o pbutil.o $(APP_CC) $(CFLAGS) $(LDFLAGS) pbinfo.o pbutil.o $(LIBS) -o $@ +pbdemo.o: pbutil.h pbdemo: pbdemo.o pbutil.o $(APP_CC) $(CFLAGS) $(LDFLAGS) pbdemo.o pbutil.o $(LIBS) -o $@ -pbinfo.o: pbinfo.c pbutil.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbinfo.c - -pbdemo.o: pbdemo.c pbutil.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbdemo.c - -pbutil.o: pbutil.c pbutil.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbutil.c - +glxgears_fbconfig.o: pbutil.h glxgears_fbconfig: glxgears_fbconfig.o pbutil.o $(APP_CC) $(CFLAGS) $(LDFLAGS) glxgears_fbconfig.o pbutil.o $(LIBS) -o $@ -glxgears_fbconfig.o: glxgears_fbconfig.c pbutil.h - $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) -c -I. $(CFLAGS) glxgears_fbconfig.c - +xuserotfont.o: xuserotfont.h +xrotfontdemo.o: xuserotfont.h xrotfontdemo: xrotfontdemo.o xuserotfont.o $(APP_CC) $(CFLAGS) $(LDFLAGS) xrotfontdemo.o xuserotfont.o $(LIBS) -o $@ -xuserotfont.o: xuserotfont.c xuserotfont.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xuserotfont.c - -xrotfontdemo.o: xrotfontdemo.c xuserotfont.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xrotfontdemo.c - +ipc.o: ipc.h +corender.o: ipc.h corender: corender.o ipc.o $(APP_CC) $(CFLAGS) $(LDFLAGS) corender.o ipc.o $(LIBS) -o $@ -corender.o: corender.c ipc.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) corender.c - -ipc.o: ipc.c ipc.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) ipc.c - -yuvrect_client: yuvrect_client.c - $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $< $(LDFLAGS) $(LIBS) -l$(GLU_LIB) -o $@ +yuvrect_client: yuvrect_client.o + $(APP_CC) $< $(LDFLAGS) $(LIBS) -l$(GLU_LIB) -o $@ -- 1.7.0.3 |
From: Dan N. <dbn...@gm...> - 2010-04-01 21:18:33
|
On Thu, Apr 1, 2010 at 12:36 PM, Jeremy Huddleston <jer...@fr...> wrote: > > This helps debugging on darwin. > > Signed-off-by: Jeremy Huddleston <jer...@ap...> > --- > progs/xdemos/Makefile | 45 +++++++++++++++------------------------------ > 1 files changed, 15 insertions(+), 30 deletions(-) > > diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile > index d5c627a..29cba0c 100644 > --- a/progs/xdemos/Makefile > +++ b/progs/xdemos/Makefile > @@ -53,17 +53,18 @@ EXTRA_PROGS = \ > > ##### RULES ##### > > -.SUFFIXES: > -.SUFFIXES: .c > +.o: $(LIB_DEP) > + $(APP_CC) $(LDFLAGS) $< $(LIBS) -o $@ > > -.c: $(LIB_DEP) > - $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ > +.c.o: > + $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $< -c -o $@ > > > ##### TARGETS ##### > > default: $(PROGS) > > +$(PROGS): $(PROGS:%=%.o) Is this necessary? I would think the prereq would be picked up implicitly like the .c from the .o. > > extra: $(EXTRA_PROGS) > > @@ -74,45 +75,29 @@ clean: > > > # special cases > +pbutil.o: pbutil.h > +pbinfo.o: pbutil.h > pbinfo: pbinfo.o pbutil.o > $(APP_CC) $(CFLAGS) $(LDFLAGS) pbinfo.o pbutil.o $(LIBS) -o $@ > > +pbdemo.o: pbutil.h > pbdemo: pbdemo.o pbutil.o > $(APP_CC) $(CFLAGS) $(LDFLAGS) pbdemo.o pbutil.o $(LIBS) -o $@ > > -pbinfo.o: pbinfo.c pbutil.h > - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbinfo.c > - > -pbdemo.o: pbdemo.c pbutil.h > - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbdemo.c > - > -pbutil.o: pbutil.c pbutil.h > - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbutil.c > - > +glxgears_fbconfig.o: pbutil.h > glxgears_fbconfig: glxgears_fbconfig.o pbutil.o > $(APP_CC) $(CFLAGS) $(LDFLAGS) glxgears_fbconfig.o pbutil.o $(LIBS) -o $@ > > -glxgears_fbconfig.o: glxgears_fbconfig.c pbutil.h > - $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) -c -I. $(CFLAGS) glxgears_fbconfig.c > - > +xuserotfont.o: xuserotfont.h > +xrotfontdemo.o: xuserotfont.h > xrotfontdemo: xrotfontdemo.o xuserotfont.o > $(APP_CC) $(CFLAGS) $(LDFLAGS) xrotfontdemo.o xuserotfont.o $(LIBS) -o $@ > > -xuserotfont.o: xuserotfont.c xuserotfont.h > - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xuserotfont.c > - > -xrotfontdemo.o: xrotfontdemo.c xuserotfont.h > - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xrotfontdemo.c > - > +ipc.o: ipc.h > +corender.o: ipc.h > corender: corender.o ipc.o > $(APP_CC) $(CFLAGS) $(LDFLAGS) corender.o ipc.o $(LIBS) -o $@ > > -corender.o: corender.c ipc.h > - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) corender.c > - > -ipc.o: ipc.c ipc.h > - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) ipc.c > - > -yuvrect_client: yuvrect_client.c > - $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $< $(LDFLAGS) $(LIBS) -l$(GLU_LIB) -o $@ > +yuvrect_client: yuvrect_client.o > + $(APP_CC) $< $(LDFLAGS) $(LIBS) -l$(GLU_LIB) -o $@ You dropped the CFLAGS from this last one, which can break when people put things like -m32 there. -- Dan |
From: Jeremy H. <jer...@fr...> - 2010-04-01 21:40:43
|
On Apr 1, 2010, at 14:18, Dan Nicholson wrote: >> +$(PROGS): $(PROGS:%=%.o) > > Is this necessary? I would think the prereq would be picked up > implicitly like the .c from the .o. Nope. Without this, it tries to compile the .c directly to the executable rather than the .o first. >> +yuvrect_client: yuvrect_client.o >> + $(APP_CC) $< $(LDFLAGS) $(LIBS) -l$(GLU_LIB) -o $@ > > You dropped the CFLAGS from this last one, which can break when people > put things like -m32 there. That should be in LDFLAGS as well. If anything, this fixes a problem where someone might (I have no idea why) do: CFLAGS="-arch i386 -arch x86_64" LDFLAGS="-arch x86_64" In that case, we'd obviously want the final exec to be x86_64 only and the intermediate object files to be both i386 and x86_64. The way things are currently, the exec would accidentally be 2-way-fat. --Jeremy |
From: Dan N. <dbn...@gm...> - 2010-04-01 22:27:29
|
On Thu, Apr 1, 2010 at 2:40 PM, Jeremy Huddleston <jer...@fr...> wrote: > > On Apr 1, 2010, at 14:18, Dan Nicholson wrote: > >>> +$(PROGS): $(PROGS:%=%.o) >> >> Is this necessary? I would think the prereq would be picked up >> implicitly like the .c from the .o. > > Nope. Without this, it tries to compile the .c directly to the executable rather than the .o first. Even after you remove the .SUFFIXES lines? Yeah, I guess it would have that assumption since the names are the same. > >>> +yuvrect_client: yuvrect_client.o >>> + $(APP_CC) $< $(LDFLAGS) $(LIBS) -l$(GLU_LIB) -o $@ >> >> You dropped the CFLAGS from this last one, which can break when people >> put things like -m32 there. > > That should be in LDFLAGS as well. If anything, this fixes a problem where someone might (I have no idea why) do: > > CFLAGS="-arch i386 -arch x86_64" > LDFLAGS="-arch x86_64" > > In that case, we'd obviously want the final exec to be x86_64 only and the intermediate object files to be both i386 and x86_64. The way things are currently, the exec would accidentally be 2-way-fat. automake/libtool certainly passes both CFLAGS and LDFLAGS during the linking step. All the other targets in this same Makefile do, too. For better or worse, I think we need to pass the CFLAGS during the link. -- Dan |
From: Jeremy H. <jer...@fr...> - 2010-04-02 00:17:46
|
On Apr 1, 2010, at 15:27, Dan Nicholson wrote: > On Thu, Apr 1, 2010 at 2:40 PM, Jeremy Huddleston > <jer...@fr...> wrote: >> >> On Apr 1, 2010, at 14:18, Dan Nicholson wrote: >> >>>> +$(PROGS): $(PROGS:%=%.o) >>> >>> Is this necessary? I would think the prereq would be picked up >>> implicitly like the .c from the .o. >> >> Nope. Without this, it tries to compile the .c directly to the executable rather than the .o first. > > Even after you remove the .SUFFIXES lines? Yep. > Yeah, I guess it would have > that assumption since the names are the same. I know it's ugly. I tried finding another way, but that's what ended up working =/ > automake/libtool certainly passes both CFLAGS and LDFLAGS during the > linking step. All the other targets in this same Makefile do, too. For > better or worse, I think we need to pass the CFLAGS during the link. ok. I'll send an updated version in a bit for review. Thanks, Jeremy |
From: Jeremy H. <jer...@fr...> - 2010-04-02 01:45:10
|
This helps debugging on darwin. Signed-off-by: Jeremy Huddleston <jer...@ap...> --- progs/xdemos/Makefile | 45 +++++++++++++++------------------------------ 1 files changed, 15 insertions(+), 30 deletions(-) diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile index f81aafe..038e21c 100644 --- a/progs/xdemos/Makefile +++ b/progs/xdemos/Makefile @@ -53,17 +53,18 @@ EXTRA_PROGS = \ ##### RULES ##### -.SUFFIXES: -.SUFFIXES: .c +.o: $(LIB_DEP) + $(APP_CC) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ -.c: $(LIB_DEP) - $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ +.c.o: + $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $< -c -o $@ ##### TARGETS ##### default: $(PROGS) +$(PROGS): $(PROGS:%=%.o) extra: $(EXTRA_PROGS) @@ -74,45 +75,29 @@ clean: # special cases +pbutil.o: pbutil.h +pbinfo.o: pbutil.h pbinfo: pbinfo.o pbutil.o $(APP_CC) $(CFLAGS) $(LDFLAGS) pbinfo.o pbutil.o $(LIBS) -o $@ +pbdemo.o: pbutil.h pbdemo: pbdemo.o pbutil.o $(APP_CC) $(CFLAGS) $(LDFLAGS) pbdemo.o pbutil.o $(LIBS) -o $@ -pbinfo.o: pbinfo.c pbutil.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbinfo.c - -pbdemo.o: pbdemo.c pbutil.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbdemo.c - -pbutil.o: pbutil.c pbutil.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbutil.c - +glxgears_fbconfig.o: pbutil.h glxgears_fbconfig: glxgears_fbconfig.o pbutil.o $(APP_CC) $(CFLAGS) $(LDFLAGS) glxgears_fbconfig.o pbutil.o $(LIBS) -o $@ -glxgears_fbconfig.o: glxgears_fbconfig.c pbutil.h - $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) -c -I. $(CFLAGS) glxgears_fbconfig.c - +xuserotfont.o: xuserotfont.h +xrotfontdemo.o: xuserotfont.h xrotfontdemo: xrotfontdemo.o xuserotfont.o $(APP_CC) $(CFLAGS) $(LDFLAGS) xrotfontdemo.o xuserotfont.o $(LIBS) -o $@ -xuserotfont.o: xuserotfont.c xuserotfont.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xuserotfont.c - -xrotfontdemo.o: xrotfontdemo.c xuserotfont.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xrotfontdemo.c - +ipc.o: ipc.h +corender.o: ipc.h corender: corender.o ipc.o $(APP_CC) $(CFLAGS) $(LDFLAGS) corender.o ipc.o $(LIBS) -o $@ -corender.o: corender.c ipc.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) corender.c - -ipc.o: ipc.c ipc.h - $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) ipc.c - -yuvrect_client: yuvrect_client.c - $(APP_CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $< $(LDFLAGS) $(LIBS) -l$(GLU_LIB) -o $@ +yuvrect_client: yuvrect_client.o + $(APP_CC) $(CFLAGS) $< $(LDFLAGS) $(LIBS) -l$(GLU_LIB) -o $@ -- 1.7.0.3 |