I'm using GNU Make for Windows to try and make this firefox extension. I cd to the directory with the makefile and make but it just sits there. If I type make clean it does the same thing.
imgur is down. Here is a picture.
Related
I'm writing a simple Makefile:
all: image
image: ./common ./source
docker build -t some-resource -f source/Dockerfile .
.PHONY: all image
I expect that image is only built when files under folders common or source have changes. But when I run make, it always run docker run even without any file change. What's the problem?
When you run make, it will try to make the first target, which is all. This causes make to make the target image. Because there is no actual file named image (you even told make that it is a phony target), it will always execute the docker command.
In this case, it is not possible for make to determine that "common and source have changes". Normally make does this by comparing the modification timestamps of the target and the dependencies but there is no actual target to check (image is not a file).
I want to create a fat library in mac. So I foll this. I copied the content of makefile into an edit text and renamed it to Makefile.mak. I opened the terminal in where the makefile is located and types "make" in the terminal and hit enter. I am getting an error that "Makefile is not found". What would be the reason for this? Where I made a mistake?
Please help me.
Thanks
Your makefile is incorrectly named. You need to rename your Makefile.mak back to 'makefile'; that's what the make command is looking for.
make looks for files with name GNUmakefile, makefile or Makefile. If you change your file's name to one of these, you can run it without a problem. If you still want to use that name, you must run the make with -f flag. Running command should be like this:
$make -f <file_name>
In your case:
$make -f Makefile.mak
I keep staring at my code and wondering why touching my file does nothing:
FILES = file1 file2
myapp: $(FILES) docs/img/barline.svg
cd docs; make html
docs/img/barline.svg: docs/notebooks/barlines.ipynb docs/data/smbinning
cd docs/notebooks; jupyter nbconvert --execute --output-dir html barlines.ipynb
If I touch docs/img/barline.svg and run make, the jupyter command is not run (as it should be, shouldn't it?). The svg file is generated by running the jupyter command. If I delete it, everything works as expected, but touching seems to do nothing.
Bah, I just spend all this time writing some other answer and it turns out I misinterpreted your problem, oops.
You say that you expect jupyter to run if you touch barline.svg.
Make uses the file timestamps to determine when to run. The rule, for non-phony targets, is simple: If any of the prerequisites is newer than the target, or the target doesn't exist, then the target is rebuilt. Otherwise, it is not. In your case:
docs/img/barline.svg: docs/notebooks/barlines.ipynb docs/data/smbinning
Touching the svg won't meet the conditions for that rule, since it is the target.
Make will only run if barlines.ipynb or smbinning is newer than barline.svg. So your expectations are off, touching barline.svg won't do anything except potentially cause any targets that use it as a prerequisite to be rebuilt themselves.
For this you'd have to touch barlines.ipynb or smbinning. That'll make them newer than barlines.svg and force it to rebuild. Or you could just delete barlines.svg, as you've discovered.
Make doesn't track build timestamps in any special place elsewhere, all its info comes from the filesystem, so if you touch a target it doesn't really have anything to compare it to to say "hey somebody modified the target, maybe I should rebuild it" (and you wouldn't want that behavior anyways, for other reasons).
there are C files in a directory and I have a makefile.
I usually use makefile to compile.
I have been wandering the role of the 'make clean'
'make clean' is just to remove files.
Though I didn't use 'make clean', t
he error and warning was shown up when there were something wrong.
I cannot realize why I need to use 'make clean' whenever I change the source file.
make is a utility is to determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them.
To prepare to use make, you must write a file called the makefile that describes the relationships among files in your program, and the states the commands for updating each file.
Once a suitable makefile exists, each time you change some source files, this simple shell command:
make
suffices to perform all necessary recompilations. The make program uses the makefile data base and the last-modification times of the files to decide which of the files need to be updated.
We generally use make clean as a generic way to tell clean up the code.ie; remove all the compiled object files from the source code. You can name it as anything you like.
It's convention only. The convention is that clean will return you to a state where all you have is the "source" files. In other words, it gets rid of everything that can be built from something else (objects, executables, listings and so on).
So make clean ; make is expected to build everything from scratch. And, in fact, you'll often find a rule like:
rebuild: clean all
which will do both steps for you.
You should never have to do a clean unless you're wanting to (for example) copy just the source files somewhere. If you have to do so after editing a file, then your Makefile is not set up correctly.
And, if you make and get an error, you should get exactly the same error if you subsequently make without fixing said error.
Scenario 1:
I checked out a project, and made some changes to a source file, and did make, and make sees the changes.
Scenario 2:
I checked out the project again to different directory (some reasons), copied the modified source file here, and did make and nothing happens, if I run the program, I don't see my changes, make doesn't see that I made change to this source file
make uses the timestamps of the files to determine what to build.
Perhaps your version-control system is checking all files out with the current time. When you copy your source over, it has a time in the past, making make think that the object file (presumably in your checkout) is newer than your source.
If that's the case, you can use touch to set the timestamp of a file to now.
Adding to existing answers:
To touch the targets, you can use the -t or --touch option of make. This option will not make the target but just touch it so that the next time you invoke make, the target will be made.
Alternatively you can use the -B or --always-make option which will unconditionally make the target irrespective of the modification of it's dependent(s).
okay, I just touched the copied (modified) source and now make recognizes the changes.
If you used cp to copy files options -a --archive -p --preserve will preserve the timestamp. That is not what you want!
Add option --no-preserve=timestamps
cp [options] --no-preserve=timestamps .....
Make sure you have your .PHONY tags and they are correct