gnu-make

How can I tell if a makefile is being run from an interactive shell?

两盒软妹~` 提交于 2021-02-18 10:41:08
问题 I have a makefile which runs commands that can take a while. I'd like those commands to be chatty if the build is initiated from an interactive shell but quieter if not (specifically, by cron). Something along the lines of (pseudocode): foo_opts = -a -b -c if (make was invoked from an interactive shell): foo_opts += --verbose all: bar baz foo $(foo_opts) This is GNU make. If the specifics of what I'm doing matter, I can edit the question. 回答1: It isn't strictly determining whether it is

Calling one target from another and also pass a variable or value in makefile

痞子三分冷 提交于 2021-02-11 14:49:12
问题 I need to call "target_1" from "target_2" plus also pass on a variable to the "target_1". .PHONY:target_1 target_1: ifeq ($(RQM_SETUP),ci) mkdir /tmp/$1 chown 1000:1000 /tmp/$1 else @echo "Nothing to do" endif .PHONY:target_2 target_2: $(MAKE) target_1(dags) So like in this eg, target_2 would call target_1 and also pass on value as "dags" to it. So that it would create a "/tmp/dags" folder 来源: https://stackoverflow.com/questions/63884790/calling-one-target-from-another-and-also-pass-a

apply the patches based on openwrt package version

流过昼夜 提交于 2021-02-11 14:10:39
问题 In openwrt, as we known, usually the patches for a certain package should be put in package/[pkg]/patches and it will be applied in Makefile via $(Build/Patch). Example: package/test/0001-1.0.1.8.fix-A.patch package/test/0002-1.0.1.8.fix-B.patch When the package update to a new version, the patches sometimes also need to be updated. Example: package/test/0001-1.0.1.9.fix-A.patch package/test/0002-1.0.1.9.fix-B.patch OR package/test/0001-1.0.2.0.fix-A.patch package/test/0002-1.0.2.0.fix-B

apply the patches based on openwrt package version

守給你的承諾、 提交于 2021-02-11 14:09:23
问题 In openwrt, as we known, usually the patches for a certain package should be put in package/[pkg]/patches and it will be applied in Makefile via $(Build/Patch). Example: package/test/0001-1.0.1.8.fix-A.patch package/test/0002-1.0.1.8.fix-B.patch When the package update to a new version, the patches sometimes also need to be updated. Example: package/test/0001-1.0.1.9.fix-A.patch package/test/0002-1.0.1.9.fix-B.patch OR package/test/0001-1.0.2.0.fix-A.patch package/test/0002-1.0.2.0.fix-B

makefile with dependency on a shared library sub project

我怕爱的太早我们不能终老 提交于 2021-02-11 12:38:10
问题 So I have a makefile. I'll just put a pseudo example for the moment just enough so that I can talk about the issue and keep it simple... Let's say I have in my makefile something like this: # Rule to build my test executable - with dependency on the library mytest build: libmytest.so g++ test.cpp -lmytest.so # Rule to build mytest library libmytest.so: g++ mytestlib.cpp -fPIC ... etc ... cc -fPIC -Wl,-soname,libmytest.so ... etc... So, if/when I change the file mytestlib.cpp , I see that

Right way to use VPATH/vpath?

随声附和 提交于 2021-02-10 16:20:30
问题 I am trying to use my Makefile (Make for Windows) by adding source paths to vpath/VPATH. This seems trivial but for some reason I am unable to get it to work My directory structure is like this: ├── Makefile ├── out\ └── src\ └── hello.cpp My Makefile is: TGT=out OBJ=hello.o VPATH=src # vpath %.cpp src all: $(TGT)\app.exe $(TGT)\app : $(TGT)\$(OBJ) g++ $^ -o $@ $(TGT)\%.o : %.cpp g++ -Wall -Wextra -Werror -c $< changing to vpath didn't help me. I seem to have something fundamentally wrong

How to use bash regex inside Makefile Target

对着背影说爱祢 提交于 2021-02-09 17:42:55
问题 In a bash script, the following regex appears to work well: MY_STRING="FirstName-LastName-Gender-Age" MY_REGEX="([^-]+)-([^-]+)$" if [[ $MY_STRING =~ $MY_REGEX ]]; then echo "Match: $BASH_REMATCH" fi I'm interested in using this script inside the Makefile. It appears to have syntax issues. For example: my-target: MY_STRING="FirstName-LastName-Gender-Age" MY_REGEX="([^-]+)-([^-]+)$" if [[ $MY_STRING =~ $MY_REGEX ]]; then echo "Match: $BASH_REMATCH" fi What would be the correct syntax for this

Using GNU Make 4.X on OSX

…衆ロ難τιáo~ 提交于 2021-02-08 10:06:55
问题 I'm following https://ninenines.eu/docs/en/cowboy/2.0/guide/getting_started/ which requires make. When I run the install scripts, the prompt tells me to use make 4.1 . I run brew install erlang git homebrew/dupes/make then brew unlink make && brew link make but which make is still /usr/bin and make -v is 3.8. How do I link to the correct, updated make? EDIT export PATH=/usr/local/bin:$PATH is the first line of my ~/.bash_profile 回答1: You need to set your PATH so that /usr/local/bin is ahead

GNU Make Under Windows: Check for cygwin in PATH

别等时光非礼了梦想. 提交于 2021-02-08 05:43:26
问题 I have been putting together a makefile in a Windows environment for my team to use. I decided to use MinGW's version of make for Windows. I put that executable with its dependencies into a repository location that should be in everyone's PATH variable. The executable was renamed "make.exe" for simplicity. Then I realized that I have to account for the case when someone has cygwin's bin folder in their path. Commands like echo, rmdir, and mkdir will call echo.exe, rmdir.exe, and mkdir.exe

See output of shell script in Makefile

↘锁芯ラ 提交于 2021-02-07 20:46:49
问题 How can I execute a shell script before building my targets in a Makefile, and see the output as it runs? I have a script called prepare.sh that generates a bunch of .pyx files. The .pyx files are the starting point of my build process involving make. It goes from .pyx -> .c -> .o -> .so I don't like having to run prepare.sh separately prior to make. I'd like make to run it for me. I got it to work but I don't see the output of the command. I'd like to see it. This is what I have now: PATH :=