Programming :: Finding Path Of Sourcefiles In Makefile?
Mar 13, 2009
im trying to write a makefile which contains :two cpp files and two header files. now i've put cppfiles in a folder called source whose path is: /root/workspace/source and header files in a folder called header whose path is:
/root/workspace/makedemo/header
my makefile is in the path:/root/workspace/makedemo my makefile was like this:
Code:
HEADERS = $(shell /root/workspace/makedemo/header ls *.h)
SOURCES = $(shell /root/workspace/source ls *.cpp)
COMPILERFLAGS = -W -Wall
DEBUGFLAGS = -g
[code].....
im sure that i've given the correct path but it is showing errors like this:
[root@localhost makedemo]# make
/bin/sh: /root/workspace/source: is a directory
/bin/sh: /root/workspace/source: is a directory
g++ -W -Wall -I. -o output
g++: no input files
make: *** [output] Error 1
AStar works on the basis of straight lines, AFAIK. In my case, we have geocoordinates and I can get the straight line distance between the waypoints. But I am wondering how approximate will the route calculated on this basis be? The actual distance "by road", which actually matters can be different.
Example. Assuming A and B are on the same plane, and will be equidistant from the goal point, if we consider a straight line between A and the goal point and, B and the goal point. The distance "by road" between A and the goal point may be greater or lesser than B. But because the AStar works on the basis of straight lines, it will return both the routes as the shortest. If yes, then which algo should be considered , if we want the results on the basis of actual distance in Km/m?
I would like to set run time library path in my makefile, so that my exe should search run time libraries in that path when executed. How to set this in makefile?
I have probably a stupid question. How do I add an include path for kernel module makefile? I want to include "test_kernel.h" in test_module.c test_kernel.h resides in a different directory with relative path "../../common/" . I can include the file specifying the relative path, which works OK:
#include "../../common/test_kernel.h"
I would like include it without the relative path and specify path in Makefile similar to -I option available in application makefiles. I have tried EXTRA_CFLAGS += -I../../common/ in the makefile but no use.
Java applet not loading image with relative path(e.g. images/1.jpg) but loads image with absolute path(i.e. from /root/user/images/1.jpg) . This is a problem when i want to host the applet on web server
How do i find the correct path to my cd-rom drive? I want to install office 2007 using wine and I have used the programmerfish tutorial and now have to do the following:type wine /path to cd/setup.exe but I cannot seem to find the correct path.
-I tried /dev/sr0/setup.exe but it returned an error. -I tried /dev/sr0/media/setup.exe. returned the same error. -I tried /dev/media/setup.exe. Also no good.
I thought using df would help me and there i found /dev/sr0/ would be my cd-rom drive. Dunno it this correct though.
I am total new to linux as I worked mostly on RTOS (symbian). My problem is, I need to find the file IOSTREAM.H and I am following commands below: 1) cd / 2) find . iostream.h ( finds the file / directory from the current path) It shows No such File or Directory
I just downloaded slackware 13.1(x86) and i'm trying to compile ndiswrapper-1.56 using the slackbuild from slackbuils.org and i'm getting this error:
Code:
Makefile:535: /usr/src/linux-2.6.33.4/arch/i486/Makefile: No such file or directory make[2]: *** No rule to make target `/usr/src/linux-2.6.33.4/arch/i486/Makefile'. Stop. make[1]: *** [modules] Error 2 make: *** [all] Error 2
I want to define _LINUX in my makefile which I would be using in my source code like #if _Linux. I do not want to #define _Linux __linux__ in my source code.
at present I compile the same code for different systems (cross compilers)I need to call libs and include paths for the different processors. At present I simply comment out the paths not needed
I am a beginner in Linux. Never did any kernel programming in Linux/Windows before. I am now on a project and I am supposed to understand a Linux Device Driver Code. It contains 6 .c files and 1 Makefile.
The make file goes as this:
I have a.c b.c c.c d.c d.c e.c f.c in the director along with the Makefile mentioned.
I'm trying to figure out how Make handles directories.
How can I modify this makefile so it will put all of the .o files in a separate build directory?
Code:
But make ignores this and still puts main.o in the base directory. And if I refer to the build directory in the dependencies for bandit, make complains about "no rule ..."
I want to keep main.cpp in the base directory, all other sources in the src directory, and all object files in the build directory.
When I put a "test" target in my Makefile containing Code: @echo "CXX= $(CXX)" it tells me "CXX= g++". But I have nothing in the Makefile assigning any value to CXX, and as far as I can tell I have no CXX environment variable (no "CXX" appears when I run the shell command "env", and "echo $CXX" returns a blank line. So where's the g++ value coming from. Is this just built into Gnu Make, or is there a configuration file for make somewhere?
Does anyone know how to get the path with a inode number by C programming? Or can I get the absolute path without giving a "path" but a inode number by C?
like this: get_path(unsigned inode); not such this function: getcwd(".", xxx); taowuwen@gmail.com
I am trying to run a script to setup environment variables and then run other commands in a make file. But the source or the dot operator (shell is bash) does not seem to take any effect as the subsequent command didn't pick the environment up. Do I have to put every lines of the environment setup in the first script into the makefile instead?
I am new to automake. When running automake command, there is an error "cannot open > py/Makefile.in: No such file or directory". How to create that file? And, what is that file for?
I am trying to use a software package written in ANSI C. It has a makefile which has to be executed first.
As soon as I execute it I get messages like: line i: command not found.
Commands for which I am getting errors :
CC = /usr/bin/gcc GCCFLAGS = -c -Wall ROOTDIR = .
My gcc compiler is located in the above directory only. In ROOTDIR also I tried giving the path in which all the required files & folders are present but still I get the command not found error in all the lines.
It builds fine when I build from the command line ( make -f sample.mk).
However, it does not build when building from eclipse (which essentially calling the same makefile). The make output shows exactly the same as what I got from the command line build, except the last line showing
I'd like to write a Makefile for my CUDA/C++ code but I didn't know how things work with CUDA, I mean there is a nvcc compiler but I don't know what I've got to do with this. Do I have to firstly run nvcc and then g++ or only nvcc to compile my CUDA/C++ code ? I found nothing on the web explaining such basic things .
So I have been trying for 8 hours to try to get the index of an element from a list in a Makefile. The problem is that after I get the index using all the methods I have tried, the index cant be used in the "word" function:
for instance: $(OUTPUT2) : INDEX = $(shell echo $(OUTPUT2) | sed -r -e "s/[ ]+/ /g" | grep -n $@ | sed 's/^([0-9]*):.*/1/')
will create a variable INDEX defined specifically for each member of OUTPUT2, so that each output knows its index. Unfortunately, when I pass this $(INDEX) into word, it doesn't work:
$(OUTPUT2) : $(word $(INDEX), $(INPUT1)) $(word $(INDEX), $(INPUT2)) echo $(INAME) $(TMPBASE) $@ and I get the error: Makefile:16: *** non-numeric first argument to `word' function: 'num'. Stop.
I feel like if I could just convert a string to a Makefile acceptable number this would just work....
I know how to manually writing a makefile for my project, but I am new in using makefile & configure file generation tools like automake to generate a makefile and a configure script file.
I had done research on tutorials for generating makefile and configure script file.
I know that I need to manually write two files (makefile.am and configure.in).
I use wxWidgets GUI library, libconfig library, and libpcap library to do my project.
wx-config is a tool that can return the library files and include directory for wxWidgets library.
When using g++ to compile my files, I need to add in this line "`/wxlib/bin/wx-config --version=2.9 --static=yes --unicode=yes --debug=yes --libs`"
I'm trying to make recursive makefile work but it's giving me two problems. I have a top folder with the main Makefile and one Makefile for each sub folder 'one' and 'two'. Makefile in subfolder 'one' and 'two' are identical. The top Makefile (still a bit messy) looking like this:
Code: # Directories CC = gcc CFLAGS = -Wall -Wextra TARGET_DIR = bin MAIN_FILE = one.c
I've been trying to work out a way to stop chunks of code being compiled using a variable in my makefile but can't work it out. What I mean is for example in my code I might have.
/****output comms portdata********/ printf(" debug comms port %d",ReadPort("ttys1);
I only wish this code to be compiled when I'm debugging. What I've tried is using #ifdef with
#ifdef COMM_PORT_DEBUG printf(" debug comms port %d",ReadPort("ttys1); #endif
Then in my make file I set COMM_PORT_DEBUG to 1 so
DEBUG_DEFS = COMM_PORT_DEBUG=1
I then thought I could put it into my in my link line
using Ubuntu file browser, I browsed my Windows network and logged on to a Windows PC. Now Ubuntu file browser shows me "C$ on WinPC" as a folder. I can open it, read/write files, etc.But from bash prompt, I don't see anything of type CIFS/SMBFS listed in the output of "mount". Only the usual suspects (like local CDROM). How can refer to Windows files from Linux commandline?
I am dealing with one FORTRAN 90 code, have made small changes.
milenko@milenkons:~/mt4$ make mt4 make: 'mt4' is up to date. milenko@milenkons:~/mt4$ ifort -c MT2DDIB1.FOR milenko@milenkons:~/mt4$ make mt4 make: 'mt4' is up to date. milenko@milenkons:~/mt4$ make mt4 make: 'mt4' is up to date. milenko@milenkons:~/mt4$ make mt4 make: 'mt4' is up to date.
I go for make command but it does not see that the source code has been modified.Than I do compilation from command line,try make again but no use. F95=ifort FFLAFGS= -O1
The following is my Makefile, I wanted to add a staic library named libtimer.a. I'm using the following Makefile. Please let me know how to add this static library: