Discussion:
Using make to build rpms
Michael Dengler
2007-07-10 17:36:12 UTC
Permalink
Hi All,

I'm attempting to create a build system that will build rpms.

I have much of the system created but have encountered an show stopper:

I have a top level Makefile like so:

---------------

RPM_DIRS = postgresql

default:
$(foreach DIR,$(RPM_DIRS),$(MAKE) -C $DIRS rpm)


---------------

And a Makefile in each of the RPM_DIRS like so:

---------------

rpm:
rpmbuild -ba postgresql-8.2.4.spec

----------------

If I r
Michael Dengler
2007-07-10 17:40:38 UTC
Permalink
Post by Michael Dengler
Hi All,
I'm attempting to create a build system that will build rpms.
---------------
RPM_DIRS = postgresql
$(foreach DIR,$(RPM_DIRS),$(MAKE) -C $DIRS rpm)
---------------
---------------
rpmbuild -ba postgresql-8.2.4.spec
----------------
*OOPS...I accidentally sent this befoer I finished...Post continues*
If I run make in the subdirectory (postgresql), it finishes fine.

If I run make in the top level directory, I get this:

GNUmakefile:70: *** multiple target patterns. Stop.

Any help would be greatly appreciated!

Thanks

Mike
Bob Proulx
2007-07-12 05:29:01 UTC
Permalink
Post by Michael Dengler
Post by Michael Dengler
RPM_DIRS = postgresql
$(foreach DIR,$(RPM_DIRS),$(MAKE) -C $DIRS rpm)
Is the "DIR" versus "DIRS" a mispelling?

You will need to enclose the full DIR variable with parens or the
variable will be $D not $(DIR).

Also make sure the starts with a TAB and not four spaces as you have
indicated in your message.

RPM_DIRS = postgresql

default:
$(foreach DIR,$(RPM_DIRS),$(MAKE) -C $(DIR) rpm)

Call me old fashioned but I would prefer portable make syntax and
would simply use a shell for loop there. It is not much more
characters, will work with any make and to my eyes seems just a little
more obvious at a glance.

RPM_DIRS = postgresql

default:
for subdir in $(RPM_DIRS); do \
(cd $$subdir && $(MAKE) rpm) || exit 1; \
done
Post by Michael Dengler
GNUmakefile:70: *** multiple target patterns. Stop.
Any help would be greatly appreciated!
For questions about GNU make which really do not have a lot of
relevance to rpm you might get better assistance asking on the
help-***@gnu.org mailing list.

HTH,
Bob

Loading...