Make Error: Missing Separator - makefile

I am attempting to install rexec into Redhat Enterprise Release 4. Everytime I attempt to use the make command I get the following error.
Makefile:15: *** missing separator. Stop.
I have looked elsewhere on the net and line 15 of the Makefile has the below:
.include (I am unsure why but this website is blanking out what comes after .include, it is bsd.kmod.mk surrounded by <>)
I have used vi to make sure that space in the middle is a TAB and not 8 spaces, this does not resolve the issue. I have placed a TAB in front of the .include as I read somewhere there has to be a tab at the beginning, I then get a different error:
make: *** No rule to make target 'rexec.ko' , needed by 'load'. Stop.
I am unsure what else I'm supposed to do to get rexec installed, any clues?
Entire Makefile:
SRCS = rexec.c vnode_if.h
KMOD = rexec
KO = ${KMOD}.ko
KLDMOD = t
KLDLOAD = /sbin/kldload
KLDUNLOAD = /sbin/kldunload
load: ${KO}
${KLDLOAD} -v ./${KO}
unload: ${KO}
${KLDUNLOAD} -v -n ${KO}
.include (I am unsure why but this website is blanking out what comes after .include, it is bsd.kmod.mk surrounded by <>)

I believe the .include should be using spaces. Check out the last part of the Makefile. It should end like this:
unload: ${KO}
<tab>${KLDUNLOAD} -v -n ${KO}
.include <bsd.kmod.mk>
Where <tab> is an actual tab character. And that blank line better be blank; no tricksy whitespace on it.

Related

Building libssh project - target pattern contains no '%'

I'm trying to install libssh-0.8.5 onto Ubuntu 16.04 using the instructions from the install.readme provided. I follow every step as stated, but I get an error after executing the make command to build the project. The error is as follows:
[ 65%] Built target exec
tests/CMakeFiles/ssh_ping.dir/flags.make:8: *** target pattern contains no '%'. Stop.
CMakeFiles/Makefile2:1696: recipe for target 'tests/CMakeFiles/ssh_ping.dir/all' failed
make[1 ]: *** [tests/CMakeFiles/ssh_ping.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I have researched and seen that it could be a syntax error somewhere in my make file that is preventing the build to continue. I have looked at the target make file giving the problem, but cant seem to identify what is causing the error.
The flag.make file is as follows:
The problem seems to be coming from the highlighted bold line. Can anyone see what I am missing?
On StackOverflow (and most other similar sites), please cut and paste text into your questions and format them using the proper markdown facilities, rather than attaching images containing text. The latter is difficult to read and we can't cut and paste it into our answer to show where things are going wrong.
You cannot embed newlines in quoted strings, in makefiles. Make is completely line-oriented and does not parse quotes at all. So to make this:
FOO = "bar
biz"
is not considered one line assigning a value containing a newline to a variable FOO. Instead, it's considered two lines, the first of which is assigning the value "bar to variable FOO and the second of which is a syntax error since make can't parse the string baz" as a valid command.
Apparently ssh wasn't installed properly on your platform, while cmake relies on it. I am a bit surprised that cmake itself did not raise an error when generating flag.make but as I don't use cmake I do not know whether it is its normal behaviour or not.
Anyway, when cmake tried to detect your version of OpenSSH it did it by running ssh and got an error message instead of the version number it wanted. This error message got inserted in the generated flag.make Makefile. Because the second line of this error message (I could copy-paste it here if it was not in a picture in your question) has the:
a: b: c
form, make tried to interpret it as a static pattern rule but as it contains no % wildcard character, make raised a syntax error.
What happens if you try to run /usr/bin/ssh -V on the command line?

Trying to remove prefix, getting "make: missing separator"

Trying to remove a file prefix using the method proposed in this thread:
Remove prefix with make
but even with a copy paste, I'm getting make's missing separator error.
FILE=/a/thing #line 16
$(FILE:a/%=%) #line 17
Makefile:17: *** missing separator. Stop.
When GNU Make processes the following:
FILE=a/thing
$(FILE:a/%=%)
The $(FILE:a/%=%) is evaluated to thing. That's the problem.
What you want is probably:
removed-prefix=$(FILE:a/%=%)
That is, create a variable removed-prefix whose expansion results in thing, or:
FILE:=$(FILE:a/%=%)

Makefile failing on last file

I'm trying to use a makefile to make some tests for my other program.
DIFF=$(TXT_FILES:$(TESTS_DIR)/%.txt=$(DIFF_DIR)/%.dif), $(STDIN_FILES:$(TESTS_DIR/%.stdin=$(DIFF_DIR)%.dif)
$(DIFF_DIR)/%.dif: $(TESTS_DIR)/%.txt $(DIFF_DIR)/%.out
./03uzduotis/getfasta $< | diff $(DIFF_DIR)/$*.out - > $#
$(DIFF_DIR)/%.dif: $(TESTS_DIR)/%.stdin $(DIFF_DIR)/%.out
cat $< | ./03uzduotis/getfasta - | diff $(DIFF_DIR)/$*.out - > $#
The problem I'm having is that when I launch the makefile, it goes through all test files except the last one, citing "There is no rule to make Test1.dif required by "tests""
I have checked by removing some Test files that it indeed dies on the last file no matter which file is the last one.
Seems like these an extraneous comma in here:
DIFF=$(TXT_FILES:$(TESTS_DIR)/%.txt=$(DIFF_DIR)/%.dif), $(STDIN_FILES:$(TESTS_DIR/%.stdin=$(DIFF_DIR)%.dif)
$(DIFF) is going to look like ddir/one.dif ddir/two.dif, ddir/stdin1.dif The middle file name there really does have a comma as part of the name. Lists in Make are separated by whitespace, not commas.
I suspect your error message isn't exact, since from your example all filenames should have been prefixed with $(DIFF_DIR)/, and the comma is the error message too.
You've also got a missing ) and a missing / in the substitution $(TESTS_DIR/%.stdin=$(DIFF_DIR)%.dif. Likely part of that is a typo in your question as the unbalanced parenthesizes would cause a parse error.

jamplus: link command line too long for osx

I'm using jamplus to build a vendor's cross-platform project. On osx, the C tool's command line (fed via clang to ld) is too long.
Response files are the classic answer to command lines that are too long: jamplus states in the manual that one can generate them on the fly.
The example in the manual looks like this:
actions response C++
{
$(C++) ##(-filelist #($(2)))
}
Almost there! If I specifically blow out the C.Link command, like this:
actions response C.Link
{
"$(C.LINK)" $(LINKFLAGS) -o $(<[1]:C) -Wl,-filelist,#($(2:TC)) $(NEEDLIBS:TC) $(LINKLIBS:TC))
}
in my jamfile, I get the command line I need that passes through to the linker, but the response file isn't newline terminated, so link fails (osx ld requires newline-separated entries).
Is there a way to expand a jamplus list joined with newlines? I've tried using the join expansion $(LIST:TCJ=\n) without luck. $(LIST:TCJ=#(\n)) doesn't work either. If I can do this, the generated file would hopefully be correct.
If not, what jamplus code can I use to override the link command for clang, and generate the contents on the fly from a list? I'm looking for the least invasive way of handling this - ideally, modifying/overriding the tool directly, instead of adding new indirect targets wherever a link is required - since it's our vendor's codebase, as little edit as possible is desired.
The syntax you are looking for is:
newLine = "
" ;
actions response C.Link
{
"$(C.LINK)" $(LINKFLAGS) -o $(<[1]:C) -Wl,-filelist,#($(2:TCJ=$(newLine))) $(NEEDLIBS:TC) $(LINKLIBS:TC))
}
To be clear (I'm not sure how StackOverflow will format the above), the newLine variable should be defined by typing:
newLine = "" ;
And then placing the carat between the two quotes and hitting enter. You can use this same technique for certain other characters, i.e.
tab = " " ;
Again, start with newLine = "" and then place carat between the quotes and hit tab. In the above it is actually 4 spaces which is wrong, but hopefully you get the idea. Another useful one to have is:
dollar = "$" ;
The last one is useful as $ is used to specify variables typically, so having a dollar variable is useful when you actually want to specify a dollar literal. For what it is worth, the Jambase I am using (the one that ships with the JamPlus I am using), has this:
SPACE = " " ;
TAB = " " ;
NEWLINE = "
" ;
Around line 28...
I gave up on trying to use escaped newlines and other language-specific characters within string joins. Maybe there's an awesome way to do that, that was too thorny to discover.
Use a multi-step shell command with multiple temp files.
For jamplus (and maybe other jam variants), the section of the actions response {} between the curly braces becomes an inline shell script. And the response file syntax #(<value>) returns a filename that can be assigned within the shell script, with the contents set to <value>.
Thus, code like:
actions response C.Link
{
_RESP1=#($(2:TCJ=#)#$(NEEDLIBS:TCJ=#)#$(LINKLIBS:TCJ=#))
_RESP2=#()
perl -pe "s/[#]/\n/g" < $_RESP1 > $_RESP2
"$(C.LINK)" $(LINKFLAGS) -o $(<[1]:C) -Wl,-filelist,$_RESP2
}
creates a pair of temp files, assigned to shell variable names _RESP1 and _RESP2. File at path _RESP1 is assigned the contents of the expanded sequence joined with a # character. Search and replace is done with a perl one liner into _RESP2. And link proceeds as planned, and jamplus cleans up the intermediate files.
I wasn't able to do this with characters like :;\n, but # worked as long as it had no adjacent whitespace. Not completely satisfied, but moving on.

"commence before first target. Stop." error

In *.mak file I receive commands "commence before first target. Stop."
I didn't change it before.
How to solve this problem?
make (or NMAKE, or whatever flavour of make you are using) can be quite picky about the format of makefiles - check that you didn't actually edit the file in any way, e.g. changed line endings, spaces <-> tabs, etc.
This means that there is a line which starts with a space, tab, or some other whitespace without having a target in front of it.
if you have added a new line, Make sure you have added next line syntax in previous line. typically if "\" is missing in your previous line of changes, you will get this error.
Also, make sure you dont have a space after \ in previous line
Else this is the error
This could be echoing outside the target, for instance
# Variable
BAR =
ifeq ($(FOO), 1)
#echo "FooBar" <----- generate the error
BAR += foobar
endif
# Targets
all:
...
...
It's a simple Mistake while adding a new file you just have to make sure that \ is added to the file before and the new file remain as it is
eg.
Check Out what to do if i want to add a new file named customer.cc
This could also caused by mismatching brace/parenthesis.
$(TARGET}:
do_something
Just use parenthesises and you'll be fine.

Resources