makefile missing separator on cygwin - makefile

I can't figure out why I'm getting the error
library.mak:95: *** missing separator. Stop.
When I use make on cygwin. The code at that specific spot is
$(eval $(RULES))
$(EXAMPLES) $(TESTPROGS) $(TOOLS): $(THIS_LIB) $(DEP_LIBS)
$(TESTPROGS): $(SUBDIR)$(LIBNAME)
examples: $(EXAMPLES)

Could you try to:
git config --global core.autocrlf false
And checkout again the repository?
I'm wondering if the \r\n isn't at fault here...

Related

Attempting to compile through MacOS Terminal: "No such file or directory"

I'm trying to compile this project from DTU. This project requires that PETSc be installed.
I have installed PETSc to /Users/hornymoose/petsc-3.13.3/
I have extracted the zip from GitHub to /Users/hornymoose/dtu
The DTU project's makefile has the following lines:
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
include ${PETSC_DIR}/lib/petsc/conf/test
In these lines, {PETSC_DIR} is to be substituted with the user's PETSc installation directory. Thus, I changed these lines to:
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/rules
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/test
To compile the code, I write make topopt in Terminal. Doing so yields:
makefile:13: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables: No such file or directory
makefile:14: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/rules: No such file or directory
makefile:15: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/test: No such file or directory
make: *** No rule to make target `Users/jhutopopt/petsc-3.13.3/lib/petsc/conf/test'. Stop.
I have gone back and manually checked that Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables, ...rules, and ...test definitely exist and do not have errors.
Why am I receiving this error? Am I indicating the directory incorrectly in my makefile? Is the syntax in the makefile incorrect?
I'm sure there is a simple solution, I'm just very new to working with Terminal in MacOS. Thank you in advance!
There is a $ in the paths:
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
^
This causes the / to be treated as a variable, and expanded to nothing because was never set. Run make with option --warn-undefined-variables to get a warning on that sort of thing. Perhaps already obvious at this point, but the correct line would be:
include /Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
Rather than manually substituting the PETSC_DIR in the makefile you can provide it through an environment variable (assuming PETSc makefiles aren't bad):
export PETSC_DIR=/Users/hornymoose/petsc-3.13.3
make topopt
...or:
PETSC_DIR=/Users/hornymoose/petsc-3.13.3 make topopt
...or pass its value to the make invocation:
make topopt PETSC_DIR=/Users/hornymoose/petsc-3.13.3

make dependency on all files in a subdirectory (git submodule)

I want to write a (GNU) make rule that depends on the existence of some file (any arbitrary file) in a subdirectory. In my specific case, that subdirectory is a git submodule.
This is what I have:
DEP = submod/.git
$(DEP):
git submodule update --init $(#D)
submod/%: | $(DEP)
# # why do I need this?
install: submod/junk.c
echo installing
If I then type make install, the git command is run (change it to mkdir -p $(#D); touch $# for a non-git-specific test), and make doesn't complain.
I have two questions. Primarily, are there any side effects to the dummy recipe for submod/% I should be concerned about? Secondly, and more interestingly, why do I need that recipe at all? If I remove it, make errors out:
make: *** No rule to make target 'submod/junk.c', needed by 'install'. Stop.
My only hypothesis is that make is doing some optimization based on the files that exist at startup, and with the no-recipe version, it thinks that it can just expect the file to exist when it's needed, but with any recipe there, it can't do that optimization, and it reevaluates when it's needed. If that's true, is it a bug, or something that should be changed?

Makefile: target pattern contains no `%'

Why does my Makefile not work?
makefile:
app-reset:
bin/console avanzu:admin:fetch-vendor
make app-reset is returning:
makefile:3: *** target pattern contains no `%'. Stop.
As explained in https://www.gnu.org/software/make/manual/make.html#Recipe-Syntax, every line in your build recipe must start with a tab character. If you use anything else (such as a sequence of spaces), you get confusing errors.
Usually this manifests as Makefile:42: *** missing separator. Stop. but in your case the colons (:) in your command confused make into thinking you were trying to define a pattern rule.
In any case, the solution is to use a tab character instead. (Or, if you are using GNU make, set .RECIPEPREFIX.)
Can you try this?
sudo apt-get install lib32ncurses5 lib32z1
I meet same problem in 18.04, but I pass the make after install lib32ncurses5 lib32z1.

Is there a way to tell my makefile to output a custom error message if a certain an include file is not found?

I have a configure script that generates a config.inc file containing some variable definitions and a makefile that imports those configurations using
include config.inc
The thing that bothers me is that if the user tries to run the makefile directly without first running configure they get an unhelpful error message:
makefile:2: config.inc: No such file or directory
make: *** No rule to make target 'config.inc'. Stop.
Is there a way for me to produce a better error message, instructing the user to first run the configure script, without resorting to the autoconf strategy of generating the full makefile from inside configure?
Sure, no problem; just do something like this:
atarget:
echo here is a target
ifeq ($(wildcard config.inc),)
$(error Please run configure first!)
endif
another:
echo here is another target
include config.inc
final:
echo here is a final target
Note this is definitely specific to GNU make; there's no portable way to do this.
EDIT: the above example will work fine. If the file config.inc exists, then it will be included. If the file config.inc does not exist, then make will exit as it reads the makefile (as a result of the error function) and never get to the include line so there will be no obscure error about missing include files. That's what the original poster asked for.
EDIT2: Here's an example run:
$ cat Makefile
all:
#echo hello world
ifeq ($(wildcard config.inc),)
$(error Please run configure first!)
endif
include config.inc
$ touch config.inc
$ make
hello world
$ rm config.inc
$ make
Makefile:5: *** Please run configure first!. Stop.
I gave up and decided to use autoconf and automake to handle my makefile-generation needs.

Bazaar syntax to ignore directories matching a wildcard

I'm sure this is a dumb question, but what is the syntax to ignore my _Resharper.* directories with Bazaar? I've tried ignoring: \_Resharper*.* ./\_Resharper*.*, **/\_Resharper*.*, plus variations of those on the wildcards. No matter what I do, it continues to pick up the directory.
You are probably bitten by the wildcard expansion occuring in the shell.
Type bzr ignore --help and look at the Examples section:
Ignore the top level Makefile: bzr ignore ./Makefile
Ignore class files in all directories: bzr ignore "*.class"
Ignore .o files under the lib directory:bzr ignore "lib/**/*.o"
Ignore .o files under the lib directory: bzr ignore "RE:lib/.*\.o"
Ignore everything but the "debian" toplevel directory: bzr ignore "RE:(?!debian/).*"
You don't need to use backslash there. Just
_Resharper.*
or
_Resharper
will work.
#caution
At least with version ~2.7.* bazaar will not easily tell you that it is ignoring a **/wildcard/* rule in cases where entities below a matched rule are already versioned (under version control).
example:
**/vendor/* still produced entries in $ bzr st for me, below vendor/ until I issued the command $ bzr remove --keep . from within the vendor/ directory

Resources