The make a lisp docs contain the following instructions:
This allows you to run tests against your implementation like this:
make "test^quux^stepX"
I've never seen ^ used with make before. It's proving very difficult to search for information on this (Google ignores it and Symbolhound hasn't found anything relevant).
What does ^ mean here? Where is this documented?
In GNU make, ^ has no particular meaning (except when used in the automatic variables ^, ^D, and ^F). The makefile of the project you linked to seems to use it as a separator for variable substitution, but this has nothing to do with make itself.
the ^ (Circumflex) seems to have to do with macro substitution. I could be wrong but this is all I could find for you. Hope it helps.
http://www.cs.nccu.edu.tw/~lien/UNIX/Command/make.htm
Related
How to debug a make Makefile containing many Makefile scripts invocations, to trace where a variable/identifier name is actually declared/defined when that variable is being used at RHS
I got workaround by this 'angel of savior' command:
$(error v = $v...... )
just put variable name to find out and move this line up/down to intercept curious, suspected part, although clearly laborious it's working awesome.
in tandem with pcre2grep search as better regex engine than basic...
at least for me... did prove the pudding is in the eating
In writing a function for fish shell I want to know if a lone wildcard (not part of a bigger expression) was used in the command arguments. Fish does the wildcard expansion before passing arguments to my function, so there is no easy way that I can see to do that, aside from check whether the arguments are the same as the output of ls. The inefficiency of that method makes me sad, though. Is there a better way to do this, without going into fish's source code?
EDIT:
Thanks for the input. Specifically, I am looking to add some functionality like zshell has for warning if there is a * in the arguments of rm. I know that there was an issue opened on GitHub specifically about this but I couldn't find the link again. I have typod, for example, rm * .o instead of rm *.o, and accidentally deleted all my code (... which I brought back from git, but still).
EDIT 2:
Here is the issue on GitHub: https://github.com/fish-shell/fish-shell/issues/1511
No, there's no way for a function to tell where its arguments came from. Maybe if you give more details about what you're really trying to accomplish, we can give another suggestion.
I was speaking with one of my fellow interns at lunch today who is working almost exclusively in Makefile this summer, and he mentioned that he has no idea what $(#:H) means or does. My google-fu is failing me, as I cannot find it anywhere on the web, and was hoping you guys could help me out.
Assuming this is GNU make then that's just the expansion of the (oddly named) #:H variable. Which isn't a default variable (and isn't a variable that can be set with the normal assignment syntax) and would be an odd choice for a variable name to begin with as it is very close to real variable expansions.
It is much more likely that this is referring to BSD make where :H is a variable modifier which (excerpt from the man page):
:H
Replaces each word in the variable with everything but the last component.
In the process of getting rid of old macros in our code, I need to define the old macro as an error with a meaningful compiler message.
E.g., old code:
#define DIVIDE_BY_TWO(x) x/2
In the new code, to prevent the usage of this macro I'd like to write:
#define DIVIDE_BY_TWO(x) #error DIVIDE_BY_TWO is obsolete, use DIV_2 instead
But when I compile the above line I get:
error C2162: expected macro formal parameter
What is the correct way to do it?
A macro can't have directives or change the preprocessor state. You could leave DIVIDE_BY_TWO undefined, but then it doesn't help to find the replacement macro. The only way to do it portably is to define it as something like this:
#define DIVIDE_BY_TWO error_DIVIDE_BY_TWO_is_obsolete_use_DIV_2_instead
Which should give an error that error_DIVIDE_BY_TWO_is_obsolete_use_DIV_2_instead is not defined and hopefully that will give enough hints has to how to replace it.
The problem with using #error is that creates an error at the time that part of the code is analyzed by the preprocessor. You want to create an error when the macro is expanded. You can't, unfortunately, use #error for that.
I don't believe there is a way to generate a clear human-readable error message reliably in portable C. (You can, of course, make the macro expand to something that's syntactically invalid, though, which will at least stop compilation.) gcc supports doing it with _Pragma. Your question is effectively equivalent to this question and the answer there explains how to use _Pragma as well as other options for creating a fatal error.
You cannot use a preprocessor directive in #define since what you're asking for is to run the preprocessor twice.
If a line begins with an # it is a directive to the preprocessor and would be interpreted. If it doesn't, then it is subjected to macro substituion and replacement if such a macro exists.
The best you could do is to define the deprecated macro as some expression that would return an error for sure.
I'm new to FreeMarker and have string I want to perform two built-ins on. For example, I have a string that needs all instances of the pipe symbol replacing with a comma and capitalizing the first letter.
I thought the syntax would be ${string?cap_first?replace("|",", ")}
But only the first built in works. I've had a look around and can't find any examples other than perhaps assigning the value to a variable and then performing the two built-ins separately.
Anybody have any ideas?
Thanks
You are using the correct syntax. Furthermore your example works for me as is. What error message you get?
There is an easy but not very elegant solution. You can chain Built-ins by wrapping them into parentheses. For instance this will work as you'd expect:
${(string?cap_first)?replace(oldString, newString)}
Hope this helps!