Mail Archives: djgpp/2001/12/20/12:18:59
DJ Delorie <dj AT delorie DOT com> wrote in message news:<200112200325 DOT fBK3P8528329 AT envy DOT delorie DOT com>...
> http://www.delorie.com/djgpp/doc/ug/larger/makefiles.html
>
> http://www.delorie.com/gnu/docs/make/make_toc.html
>
> You shouldn't need to worry about the shell until you get into more
> complex Makefiles. I suggest avoiding that until you get the hang of
> simple Makefiles. DJGPP's make is quite capable of supporting the
> command.com syntax as well as emulating a number of simpler shell-isms
> internally. But, the commands you use in a Makefile should be no
> different than the ones you'd use in a batch file. Make's job is
> primarily to decide *which* commands to run, not to make the commands
> more complex.
>
> http://www.delorie.com/gnu/docs/make/make_16.html talks about
> automatic dependency generation, but that's more robust (and complex)
> than most need. For simple DJGPP Makefiles, just add -MMD to your gcc
> options, and put this at the end of your Makefile:
>
> DEPS=$(wildcard *.d)
> ifneq ($(DEPS),)
> include $(DEPS)
> endif
>
> And it's best to be simple anyway :-)
>
> You're not at a disadvantage by not knowing unix (well, posix). There
> are a few traditional things (like using dashes for command-line
> options, and that they preceed other non-options) but you'll pick
> those up quickly enough.
The main reason I was thinking I'd have to use an alternative shell to
command.com, was because of this example from the make docs:
%.d: %.c
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
Phew! I think I'll use the method you describe for dependencies,
instead ;)
Thanks for your help.
- Raw text -