On Mon, 11 Nov 1996 mch@gladstone.uoregon.edu wrote:
> Okie I am trying to put in the auction.c code and I am having trouble
> with the Makefile I added the auction.c in the main part but then I also
> added the lines:
>
> auction.o: auction.c conf.h sysdep.h structs.h utils.h comm.h
> interpreter.h \
> handler.h db.h
> $(CC) -c $(CFLAGS) auction.c
I've answered this question a billion times over, so perhaps this
should go in the FAQ somewhere. Anyway, here's the format and
here's what EVERYONE does wrong (so it's not just you):
file.o: file.c headers.h
(TAB)$(CC) -c $(CFLAGS) file.c
Note the (TAB). You cannot use spaces, it must be a TAB character.
Don't ask me why, it just has to be. You shouldn't TAB before the
continuation of your dependencies list. Therefore, this should look
like:
auction.o: auction.c conf.h sysdep.h structs.h utils.h comm.h \
interpreter.h handler.h db.h
$(CC) -c $(CFLAGS) auction.c
BTW, my favorite way of adding these lines is:
% gcc -MM <c file> >> Makefile
Then go down to the bottom of the Makefile, press ENTER, TAB, type
out "$(CC) -c $(CFLAGS) <filename>" and press ENTER again. Maybe a
script would work...
#!/bin/sh
gcc -MM $1 >> Makefile
echo " \$(CC) -c \$(CFLAGS) $1" >> Makefile
A brief test shows that that works quite nicely. So instead of
having to type out those lines you can do "add_file auction.c".
Of course, you'll need to manually add it to the OBJS list since
I can't think of a way for the script to do that.
--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST