From: K Anandan <anandan@comodo.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: Error in Makefile for multiple files
Date: Tue, 30 Aug 2005 14:15:21 -0400 [thread overview]
Message-ID: <1125425721.2549.15.camel@ttddtanandan.comodo.com> (raw)
In-Reply-To: <6a00c8d505083001018d3d42d@mail.gmail.com>
Sagar Shinde
On Tue, 2005-08-30 at 04:01, Steve Graegert wrote:
> On 8/29/05, Sagar Shinde <sagar.shinde@patni.com> wrote:
> >
> > Hi all,
> >
> > I have a module with 3 C files: smarthook.c restore.c backup.c
> >
> > My Makefile code is:
> > -----------------------------------------------------
> > INCLUDEDIR = /usr/src/kernels/linux-2.6.12.1/include
> >
> > CFLAGS = -D__KERNEL__ -DMODULE
> > CFLAGS += -I$(INCLUDEDIR)
> >
> > TARGET = smarthook
> > OBJS = $(TARGET).o
> > SRC = smarthook.c backup.c restore.c
> >
> > all: .depend $(TARGET).o
Here you change
all: .depend $(TARGET)
> >
> > $(TARGET).o: $(SRC:.c=.o)
Here you change
$(TARGET) : $(SRC:.c=.o)
> > $(LD) -r $^ -o $@
> >
> > depend .depend dep:
> > $(CC) $(CFLAGS) -M *.c > $@
> > -----------------------------------------------------
> >
> > now though I am giving proper dependencies
> > why am I not able to access global variables defined in one file
> > (smarthook.c)
> > from other files, inspite of these variables being declared extern in other
> > files.
>
> Although I am not a make guru I can't see something unusual in this
> fairly simple makefile. Does the module compile and link properly
> without using a makefile, i.e. compiling and linking manually? Is the
> contents of .depend exactly what you expected after calling make?
>
> Please, let us know if you have results you want to share.
>
> Regards
>
> \Steve
>
> --
>
> Steve Graegert <graegerts@gmail.com>
> Software Consultancy {C/C++ && Java && .NET}
> Mobile: +49 (176) 21248869
> Office: +49 (9131) 7126409
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Your program will work fine
Ananth
prev parent reply other threads:[~2005-08-30 18:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-29 15:08 Error in Makefile for multiple files Sagar Shinde
2005-08-30 8:01 ` Steve Graegert
2005-08-30 18:15 ` K Anandan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1125425721.2549.15.camel@ttddtanandan.comodo.com \
--to=anandan@comodo.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).