Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't generate correct ninja rules for certain Makefile #215

Closed
nigangkaka opened this issue Nov 12, 2020 · 1 comment
Closed

Can't generate correct ninja rules for certain Makefile #215

nigangkaka opened this issue Nov 12, 2020 · 1 comment

Comments

@nigangkaka
Copy link

The following Makefile can't generate correct ninja rules.
(PS: I have an main.cc contains simple "hello world" demo")

LOCAL_PATH            := .

TARGET                = Hello


EXTRA_LDFLAGS    = -Wl,--gc-sections -Wl,--strip-all


LOCAL_SRC	+= $(wildcard ${LOCAL_PATH}/*.cc)

OUT_BIN = $(patsubst ${LOCAL_PATH}/%.cc, ${LOCAL_PATH}/%.bin, ${LOCAL_SRC})


${LOCAL_PATH}/%.o: ${LOCAL_PATH}/%.cc
	@g++ -c $^ -o $@

$(LOCAL_PATH)/%.bin : $(LOCAL_PATH)/%.o
	@objcopy -O binary $^ $@
	@g++ $^ $(EXTRA_LDFLAGS) -o ${TARGET}
	@rm -rf $^
	
create_bin: $(OUT_BIN)
	@echo "Create Bin files Done"

.PHONY: all

all: create_bin


It only generates:

# Generated by kati d9189545ad0cc0d6d49e7d10d4ffcf622739e86b

pool local_pool
 depth = 16

build _kati_always_build_: phony

# Makefile:27
rule rule0
 description = build $out
 command = /bin/sh -c "echo \"Create Bin files Done\""
build create_bin: rule0 main.bin

default create_bin

Then if I run "make" under the folder which contains the Makefile I will get "main.bin" and Hello.

But if I run "source ./ && ./ninjia.sh" i get the follow error message:

ninja: error: 'main.bin', needed by 'create_bin', missing and no known rule to make it

@nigangkaka nigangkaka changed the title Can't generate correct ninja rules for Can't generate correct ninja rules for certain Makefile Nov 12, 2020
@Colecf
Copy link
Collaborator

Colecf commented Nov 18, 2022

Duplicate of #245

@Colecf Colecf marked this as a duplicate of #245 Nov 18, 2022
@Colecf Colecf closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants