Sponsored Content
Full Discussion: Makefile help
Top Forums Shell Programming and Scripting Makefile help Post 302715019 by bakunin on Saturday 13th of October 2012 02:10:06 PM
Old 10-13-2012
Quote:
Originally Posted by football12345
Code:
make foo . make $(EXE)

i get

Code:
EXE: command not found
make: `foo' is up to date.
make: Nothing to be done for `.'.
make: *** No rule to make target `make'.  Stop.

Not sure what the errors mean
The errors are to take quite literally:

You execute "make" with the arguments "foo" "." "make" and "$(EXE)".

The first error is from the shell, because "$(EXE)" means run command "EXE" in a subshell and put its output here. The shell thinks that the rest of the command depends on what EXE might output and therefor execute it first - as there is no "EXE, this fails.

Next, "make" is executed and takes the argument: "foo". For "foo" exists a target to make and "make" does try to make it but notices that it has already done so and in the meantime "foo" hasn't changed - so it tells you that "foo" is already up to date. Next make tries to "make .". As "." is the current directory and there is no rule in your makefile describing how to make "." "make" tells you so. Finally it tries to make "make", which would be (like ".") a perfectly valid target to make - IF it would exist in your makefile. As it doesn't, "make" tells you the same as with ".": it can't make it, because you haven't told it how.

But instead of writing a long-winded make-exegesis, i could probably tell you what you need to know, so: what exactly do you want to achieve? Have you ever used a makefile and know its purposes? Its syntax?

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Programming

about the makefile

can anyone well explain how to create a makefile? especially those commands in the makefile? BTW, what is CFLAG? (2 Replies)
Discussion started by: ligerdave
2 Replies

2. High Performance Computing

help with makefile

I am new to creating makefiles. I have several fortran programs in a folder called as "test" and also have several subroutines in another folder (which is inside this test folder) called as libry My makefile is in the folder "test" I want to create a makefile which can access the files in... (2 Replies)
Discussion started by: explorer
2 Replies

3. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

4. UNIX for Advanced & Expert Users

Makefile executing another Makefile first?

I have 2 libraries in 2 different directories that I build with Makefiles. library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A? I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
Discussion started by: wwuster
0 Replies

5. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

6. Homework & Coursework Questions

Makefile Help

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I have been trying to make the program swap but i have been getting errors with the makefile such as driver.o:... (1 Reply)
Discussion started by: mgyeah
1 Replies

7. UNIX for Dummies Questions & Answers

Help with MakeFile

I'm really confused how to use a makefile. Are you supposed to be make a file from emacs called MakeFile and put code in there to compile? I am trying to create a makefile to compile two .cpp files in my current directory to produce two .o files and then link them... What I did was make a... (1 Reply)
Discussion started by: jzhang172
1 Replies

8. Shell Programming and Scripting

Makefile

Dear all, I have a quite simple question about how to manipulate "makefile.am". I intend to: 1. "CFLAGS" and "CXXFLAGS" have no value at all. I know that these values get "-g -O2" by default. On the other hand, when I try to set them as "CFLAGS = " in "makefile.am", I get warning messages... (4 Replies)
Discussion started by: Dandan
4 Replies

9. UNIX for Dummies Questions & Answers

MakeFile

Hey everybody, This may be stup*d question for you, but i am new in unix and i wonder how can i make the rules for translating and linking my .c "primjer1.c", "primjer2.c" and "primjer3.c" in makefile. Thank you. (7 Replies)
Discussion started by: jskako
7 Replies

10. Programming

Makefile for g++

Hi All, We have moved our OS from Sun Solaris to Linux and also some of the compilers. Our old makefile used to be as below: CC=cc FLAGS=-G -KPIC -DLG_SOLARIS_OS DEFINES=-DSunOS SYSLIBS=-lc .SUFFIXES : .c .c.o : ;$(CC) -c $(FLAGS) $(DEFINES) $*.c -o $*.o ... (3 Replies)
Discussion started by: shash
3 Replies
MMAKE(1)							   User Commands							  MMAKE(1)

NAME
mmake - generate a Java Makefile SYNOPSIS
mmake [ -d | -v ] DESCRIPTION
This program will generate a Makefile for Java source files. Use the -d option to accept all defaults. After running mmake, you will obtain a Makefile in the directory from where you started the program. The Makefile will handle java files in the current directory and in any sub-directories. Use the generated Makefile with mmake as follows: To compile Java files just type make. It's also possible to run make with one of the following targets: doc, clean, help, jar, srcjar, bun- dle, install, uninstall, tags and depend Where 'make doc' runs javadoc on the source files, it will only work for files in a package. The command 'make clean' removes class files and other temporary files. The command 'make jar' creates a jar file with all class files (and other files of your choice, see the JAR_OBJS variable in the Makefile). The command 'make srcjar' creates a jar file with all java files. The command 'make bundle' creates a Mac OS X Application Bundle with all the jar file. The command 'make install' will install a jar file, app bundle, class files and any shell wrappers you have made. (A shell script must have the extension .sh to be installed). Use 'make unin- stall' to remove installed files. The command 'make help', shows a help text with available targets. The command 'make tags' will generate a tag file for Emacs. And finally the command 'make depend' creates a dependency graph for the class files. (The dependency graph will be put in a file called makefile.dep, which is included in the Makefile) You don't have to run mmake each time you add a new java file to your project. You can add as many new java files as you like, the Makefile will find them. This is the case as long as you don't add a new package. In that case, you must either run mmake again or update the PACK- AGE variable in the Makefile. This is because the Makefile uses this variable to find directories with java files. The program mmake is able to create a dependency graph for your java files. To do this, it needs the jikes compiler from IBM. Get jikes from http://www.ibm.com/developerworks/oss/jikes/.You would probably be more content with jikes anyhow, since it is much faster than javac. To create a dependencies graph, do a make clean before running make depend. A NOTE ON INSTALLATION
The Makefile created with mmake will do a fair job installing the different files that makes up your system. It uses the following Makefile variables when it conducts the install routine: o PREFIX o CLASS_DIR o JAR_DIR o BUNDLE_DIR o DOC_DIR o SCRIPT_DIR PREFIX This variable will be prepended to all other directory variables above. It is used for grouping the other directories into one root direc- tory. If you don't want that, you may simply set the variable to an empty string in the Makefile. If the variable is empty you could still use it on the command line when you run make, for instance for a one-shoot installation like: make PREFIX=/local/myproject/ install CLASS_DIR This variable denotes the top directory from where all class files will be installed. Its default value is classes, which I believe is a good value. Note: If you don't want to install any class files (because you are, for example, only going to use a jar file), set this vari- able to an empty string and no class files will be installed. Resource files will also be installed below this directory if such files are present in a package structure. This is useful if you are using e.g. ResourceBundles to Localize your application and have your property files in it's own directory in the package structure. JAR_DIR This variable tells the Makefile where to install the jar file. The default value is lib, which is also a good default value. BUNDLE_DIR This variable tells the Makefile where to install the app bundle. The default value is lib, which is also a good default value. DOC_DIR When you run javadoc, all the html files will be put into this directory. Its default value is doc/api-docs. You should probably keep that name, but then again, you may change it as you like. SCRIPT_DIR The Makefile uses this variable to install any shell wrapper-scripts that you have created. If you write an application, it is always nice for the user that you provide a wrapper script to start the application. Its default value is bin. (The Makefile will only install shell- scripts that has the extension .sh. The mmake script will tell the Makefile where to look for shell-scripts) INSTALLATION SUMMARY If you keep the default values you will get an installation tree that looks like this: `-- PREFIX |-- bin |-- classes | `-- package <--- Example of a sub-directory | |-- sub-package1 | |-- sub-package2 | `-- sub-package3 |-- doc | `-- api-docs `-- lib USING THE C-PREPROCESSOR This is a excellent tool for managing projects with several different versions. The idea behind using the C preprocessor with Java is to better manage different versions more easily. This is done by using CPP conditional statements in the source files. I would strongly advise you not to use CPP to redefine the Java language itself. To use the C preprocessor together with Java, you can change the name of the source files that you want to preprocess -- from <file- name>.java to <filename>.xjava. The Makefile has a rule to build .class files from .xjava files. It is not necesarry to change every file from .java to .xjava. The Makefile will work well and consistently in an environment of both .java and .xjava files. (E.g. 'make clean' will only remove .java files that were created from a .xjava file. Other java files will, of course, not be removed.) You can now use cpp Conditionals in Your Java-code, for example, as follows: #ifdef JAVA1_1 [code1] #else [code2] #endif The JAVA1_1 label in the above example is tested against the VERSION variable in the Makefile. That is, if the VERSION variable is JAVA1_1, then [code1] would be compiled and [code2] left out. Likewise, if VERSION is something else than JAVA1_1, then [code2] would be compiled and [code1] left out of the resulting .class file. NOTES
mmake will give you one Makefile for managing your Java files. Although it's easy to setup and use mmake in a recursive makefile context, you don't want to do that. To see why, read the excellent article: Recursive Make Considered Harmful at http://www.canb.auug.org.au/~millerp/rmch/recu-make-cons-harm.html DEPENDENCIES
mmake will need the following: o Perl 5.x o Gnu make o Gnu xargs (recommended) AUTHOR
Jan-Henrik Haukeland <hauk@tildeslash.com> April 2. 2004 www.tildeslash.com MMAKE(1)
All times are GMT -4. The time now is 03:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy