Re: Makefile???, not very good with them.

Hi there..

On Mon, 2003-01-20 at 06:41, Hammamur Rahman wrote:
Hi, i followed the description you gave of a make file, thank you it was 
very helpful.  I have re-written my makefile as follows but it is still 
coming up the same error, where have i gone wrong?:

gcc.exe: no input files
MAKE: *** [duv.exe] Error 1

go to your source dir and do
make duv.o

what does it say?


# Compiler
# Parameters given to the compiler
CFLAGS=-s -mwindows -mno-cygwin -fnative-struct -I"\gtk-2.0" 
-I"\gtkdeps-2.0" -I"\gtk-2.0\include" -I"\atk-1.0" -I"\pango-1.0" 
-I"\glib-2.0" -I"\glib-2.0" -I"\glib-2.0\include"

BFLAGS=-lgtk-win32-2.0 -lgdk-win32-2.0 -lgthread-2.0 -lgdi32 -lole32 -luuid 
-latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 
-lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv

# Standard targets

duv.exe: duv.o dir_stack.o quota_info.o
      $(CC) duv.o dir_stack.o quota_info.o -o duv.exe $(BFLAGS)

duv.o: duv.c duv.h
      $(CC) -c duv.c $(CFLAGS)

dir_stack.o: dir_stack.c dir_stack.h
      $(CC) -c dir_stack.c $(CFLAGS)

quota_info.o: quota_info.c quota_info.h
      $(CC) -c quota_info.c $(CFLAGS)

      del *.o


Thank you!

From: horrorvacui gmx net
To: gtk-app-devel-list gnome org
Subject: Re: Makefile???, not very good with them.
Date: Sun, 19 Jan 2003 15:42:42 +0100

On Sun, 19 Jan 2003 13:57:07 +0000
"Hammamur Rahman" <hrahman10 hotmail com> wrote:

The error i'm presently getting is:

gcc.exe: no input files
MAKE: *** [duv.exe] Error 1

I think this a very simple problem.  The main problem is I just don't
know how to write a makefile properly.  Could you please amend the one
I'v given and if you have time explain alitlle what each line does.

Quite simple. Basically, the Makefile serves to define "targets" and what
to do to obtain them. The simplest posible Makefile, equivalent to running
gcc foo.c -o bar would be:

bar: foo.c
    gcc foo.c -o bar

This makes hardly any sense, but it shows nicely what it's all about. The
target is "bar" (watch the format of the file; a target is something that
begins on the first character of a line, commands begin with an empty
space), and its dependence is what is behind the colon (:). Make checks
the datastamps of both files, and runs the command beneath the target
definition, if:
1) there's no "bar" file
2) the datastamps show that "foo.c" is newer than "bar" - if foo.c is
edited, that is.
Otherwise, make says bar is up to date and does nothing.
Most makefiles use variables for commands. So you can have:
CFLAGS=-Wall -pedantic
and the command for the target is then:
    $(GCC) $(CFLAGS) foo.c -o bar

A bit more complex Makefile (a Makefile that makes sense) may look like
CFLAGS=-Wall -pedantic

foobar: foo.o bar.o
    $(GCC) $(CFLAGS) foo.o bar.o -o foobar

foo.o: foo.c
    $(GCC) $(CFLAGS) -c foo.c

bar.o: bar.c
    $(GCC) $(CFLAGS) -c bar.c

The first target is the default target. Its dependancies are further
targets, so make jumps to them and checks their dependancies. Whenever it
finds a target that's not up to date, it will execute the command below
the target definition. In this case, if you edit bar.c, it will check
foo.o and do nothing, check bar.o and find it's not up to date, compile
it, and link both object files to foobar.
When invoked without arguments, make will make the default target (the
first appearing), otherwise you can specify them - like "make clean" to
clean the directory of .o files, if you've defined a target "clean":

    rm -f *.o

The commands executed are those available from the shell you're using. I
use Linux, so you see bash commands here. If you're using dos, use
commands available there, "del *.o" instead of "rm -f *.o" etc...


Horror Vacui

Registered Linux user #257714

Go get yourself... counted:
- and keep following the GNU.
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

The new MSN 8 is here: Try it free* for 2 months

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]