LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   stupid makefile question (https://www.linuxquestions.org/questions/linux-newbie-8/stupid-makefile-question-244887/)

drumlix18 10-19-2004 09:33 PM

stupid makefile question
 
i dont know why this is doing this. i have a makefile setup to run...

compiler = /usr/bin/g++

compilerflags = -ansi -Wall

OBJECTS = driver.o

driver: driver.o
$(compiler) $(compilerflags) -o driver driver.o

driver.o: driver.c /usr/include/driver.h
$(compiler) $(compilerflags) -c driver.c

it compiles and i get driver as the executable.

but how do i run it? it's been a while for me and i get

bash: driver: command not found when i type in driver

any ideas? :(

btmiller 10-19-2004 09:57 PM

./driver . (the current directory) usually isn't in your $PATH, so you have to specify it explicitly.

drumlix18 10-19-2004 10:12 PM

im not sure what you mean...

homey 10-19-2004 10:35 PM

How about the command: make driver

drumlix18 10-19-2004 10:41 PM

that gives me the same thing, i already have the target as driver

Tinkster 10-19-2004 10:46 PM

What btmiller means is that instead of typing
driver<enter>
you should use
./driver<enter>
because in Linux by default executables are
only picked when they can be found in the
directories that the path variable points at
echo $PATH
for a test ... alternatively, you can use a
qualified filename to run it, e.g.
/home/user/src/mypackage/driver
or a shorthand that contains a reference to
a directory, e.g.
~/mypackage/driver
or, as suggested above,
./driver

[edit]
For more detail have a look at the output of
ls -la
in a not too full directory... at the top of the listing
you'll see something like
Code:

[tink@diggn:/tmp]$ ls -la
total 959961
drwxrwxrwt  39 root    root      2424 2004-10-20 16:23 .
drwxr-xr-x  20 root    root        504 2004-10-14 10:38 ..

drwxrwxrwt  2 root    root        168 2004-10-20 16:23 .ICE-unix
-r--r--r--  1 root    root        11 2004-10-20 16:22 .X0-lock
drwxrwxrwt  2 root    root        72 2004-10-20 16:22 .X11-unix

Note the top two entries in the listing. They refer
to the current directory (.) and the parent directory (..)
[/edit]





Cheers,
Tink


All times are GMT -5. The time now is 04:41 PM.