gnu-make

makefile - How to assign a value to a variable on specific target?

末鹿安然 提交于 2020-01-25 06:42:06
问题 In the below code snippet: IMAGES_TO_DELETE := $(aws ecr list-images --region $(ECR_REGION) --repository-name $(ECR_REPO) --filter "tagStatus=UNTAGGED" --query 'imageIds[*]' --output json) .PHONY: target1 target2 cleanimage cleanimage: ${DISPLAYINFO} "Clean untagged image from AWS ECR " aws ecr batch-delete-image --region $(ECR_REGION) --repository-name $(ECR_REPO) --image-ids "$(IMAGES_TO_DELETE)" || true ${DISPLAYINFO} "Done" target1: # do something target2: # do something IMAGES_TO_DELETE

How can i split string with dot in makefile

人盡茶涼 提交于 2020-01-24 06:28:02
问题 I have make target like this test.% export var1=$(basename $*) && export var2=$(subst .,,$(suffix $*)) and i use like test.var1.var2 Now i want to do one more level like test.var1.var2.var3 how can i get that in makefile edit: The reason i want to do this is because i am using Make file for deploying multiple apps and i want many variables . so that user ca deploy like make install.{app1}.{test}.{build_number} 回答1: Use subst to replace dots with spaces so that it becomes a list. Then use word

How can i split string with dot in makefile

陌路散爱 提交于 2020-01-24 06:27:09
问题 I have make target like this test.% export var1=$(basename $*) && export var2=$(subst .,,$(suffix $*)) and i use like test.var1.var2 Now i want to do one more level like test.var1.var2.var3 how can i get that in makefile edit: The reason i want to do this is because i am using Make file for deploying multiple apps and i want many variables . so that user ca deploy like make install.{app1}.{test}.{build_number} 回答1: Use subst to replace dots with spaces so that it becomes a list. Then use word

GNU-Make does not recompile when a header file changed

泪湿孤枕 提交于 2020-01-23 08:58:32
问题 GNU-Make does not recompile when hdr.h file changed. As below printed lines, it did not try to recompile even main.d file is generated. Can you guide me why it happend? hdr.h #ifndef __HDR_H__ #define LOOP_CNT 1000 #endif /* __HDR_H__ */ main.c #include <stdio.h> #include "hdr.h" int main(void) { int i, sum = 0; for (i = 0; i < LOOP_CNT; i++) sum += i; (void)printf("sum = %d\n", sum); return 0; } Makefile SUFFIXES += .d .PHONY: clean OBJECTS = $(patsubst %.c,%.o,$(wildcard *.c)) CC = armcc LD

GNU-Make does not recompile when a header file changed

偶尔善良 提交于 2020-01-23 08:58:21
问题 GNU-Make does not recompile when hdr.h file changed. As below printed lines, it did not try to recompile even main.d file is generated. Can you guide me why it happend? hdr.h #ifndef __HDR_H__ #define LOOP_CNT 1000 #endif /* __HDR_H__ */ main.c #include <stdio.h> #include "hdr.h" int main(void) { int i, sum = 0; for (i = 0; i < LOOP_CNT; i++) sum += i; (void)printf("sum = %d\n", sum); return 0; } Makefile SUFFIXES += .d .PHONY: clean OBJECTS = $(patsubst %.c,%.o,$(wildcard *.c)) CC = armcc LD

How do I get $(error …) to work conditionally in GNU Make?

馋奶兔 提交于 2020-01-22 14:19:06
问题 I'd like to use $(error ...) to abort my make process if certain preconditions aren't met. The fails_to_work target should abort when failing test -d /foobar . BAD.mk all: this_works fails_to_work this_works: @echo echo works... @test -d ~ || echo ~ is not a directory @test -d /foobar || echo /foobar is not a directory fails_to_work: @echo error does not work... @test -d ~ || $(error ~ is not a directory) @test -d /foobar || $(error /foobar is not a directory) $ make -f BAD.mk echo works...

Print timestamp in makefile

前提是你 提交于 2020-01-17 01:30:10
问题 I want to measure the time for each of build item in make file, i just try below, why does it not work? mytest: $(info 'Now time is $(date --iso=seconds)') The date is not printed, just printed 'Now time is ' . What can be wrong? make --version GNU Make 3.81 回答1: There is no make function named date . If you want to invoke a shell command, the syntax is $(shell date) . Using $(info) in a recipe is not particularly elegant; the function doesn't produce anything which is useful to pass to a

How to run “gmake install”?

百般思念 提交于 2020-01-14 22:36:53
问题 I am now installing a code on my mac. The code is from here. Look for "Benchmark and Boundary Detection Code" in this page. In the readme file, it says: (1) For the image and segmentation reading routines in the Dataset directory to work, make sure you edit Dataset/bsdsRoot.m to point to your local copy of the BSDS dataset. (2) Run 'gmake install' from this directory to build everything. You should then probably put the lib/matlab directory in your MATLAB path. (3) Read the Benchmark/README

How to run “gmake install”?

纵然是瞬间 提交于 2020-01-14 22:24:05
问题 I am now installing a code on my mac. The code is from here. Look for "Benchmark and Boundary Detection Code" in this page. In the readme file, it says: (1) For the image and segmentation reading routines in the Dataset directory to work, make sure you edit Dataset/bsdsRoot.m to point to your local copy of the BSDS dataset. (2) Run 'gmake install' from this directory to build everything. You should then probably put the lib/matlab directory in your MATLAB path. (3) Read the Benchmark/README

make error 2 on Windows when building fastText

旧巷老猫 提交于 2020-01-14 06:16:47
问题 I'm trying to build fastText (Facebook's library for learning of word representations and sentence classification) and have tried followed the instructions on their Github page: $ git clone git@github.com:facebookresearch/fastText.git $ cd fastText $ make I installed GnuWin32 and added to the path in order to use the make function. I'm on Windows 10. However I get the following error: $ make c++ -pthread -O3 -funroll-loops -std=c++0x -c src/args.cc process_begin: CreateProcess(NULL, c++