Ken Kreb wrote:
> Ok how do you add a new .c file to your makefile?
> ea; what all has to be done to make it work?
You add to Makefile.in:
OBJFILES = ... newfile.o
Then you add a ``newfile.o'' definition in the end of the file,--
newfile.o: newfile.h newfile.c
$(CC) -c $(CFLAGS) newfile.c
It is the simpliest way. The way I'd prefer is adding new modules to
the Makefile via ``gcc -MM''. I wrote a little script to generate the
OBJFILES and the definitions sections... It is on your head to understand
what's for what further. :)
genmm.sh:
#!/bin/sh
out=genmm.out
rm -f ${out}
echo -n "OBJFILES =" >>${out}
for file in *.c; do
filealt="`echo ${file}|sed -e \"s/^\(.*\)\.c$/\1/\"`"
echo -n " ${filealt}.o" >>${out}
done
echo >>${out}
echo >>${out}
for file in *.c; do
gcc -MM ${file} >>${out}
printf "\t\$(CC) -c \$(CFLAGS) ${file}\n" >>${out}
done
(end-of-file)
> and what does the makefile do?
> thanks for your time.
It checks if you have such and such files or if they were modified
since last compilation and to those which looks updated/new it will
execute a particular command you tell it to do... In other words,
like most other programmes, it does exactly what you tell it to do. :)
--
Yura Ushakhow <yura@sunet.ru>
Moscow, Russia
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT