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

Fix misused tabs in Makefiles #1018

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SharzyL
Copy link

@SharzyL SharzyL commented Mar 2, 2024

Makefile use tabs to identify the lines of recipes. If using tabs in a non-recipe part, it may complain ‘recipe commences before first target. Stop. (Makefile manual) and quits.

@SharzyL SharzyL changed the title Fix misued tabs in Makefiles Fix misused tabs in Makefiles Mar 2, 2024
@haitaohuang
Copy link
Contributor

You need add Signed-off-by tag in commit. See CONTRIBUTING.md
Also please add the version of make and info of OS on which you encountered the error.

@SharzyL
Copy link
Author

SharzyL commented Apr 6, 2024

The error do not occur in ordinary build process since the problematic corresponding branch is not triggered. But we can manually trigger it by

$ make ARCH=whatever USE_CRYPTO_LIB=0 clean
make[1]: Entering directory '/linux-sgx/sdk'
make -C tlibc/                              clean
make[2]: Entering directory '/linux-sgx/sdk/tlibc'
make[2]: Leaving directory '/linux-sgx/sdk/tlibc'
make -C tlibthread/                         clean
make[2]: Entering directory '/linux-sgx/sdk/tlibthread'
make[2]: Leaving directory '/linux-sgx/sdk/tlibthread'
make -C compiler-rt/                        clean
make[2]: Entering directory '/linux-sgx/sdk/compiler-rt'
make[2]: Leaving directory '/linux-sgx/sdk/compiler-rt'
make -C cpprt                               clean
make[2]: Entering directory '/linux-sgx/sdk/cpprt'
make[2]: Leaving directory '/linux-sgx/sdk/cpprt'
make -C tlibcxx/                            clean
make[2]: Entering directory '/linux-sgx/sdk/tlibcxx'
make[2]: Leaving directory '/linux-sgx/sdk/tlibcxx'
make -C tseal/linux/                        clean
make[2]: Entering directory '/linux-sgx/sdk/tseal/linux'
make[2]: Leaving directory '/linux-sgx/sdk/tseal/linux'
make -C selib/linux/                        clean
make[2]: Entering directory '/linux-sgx/sdk/selib/linux'
make[2]: Leaving directory '/linux-sgx/sdk/selib/linux'
make -C trts/                               clean
make[2]: Entering directory '/linux-sgx/sdk/trts'
make -C linux clean
make[3]: Entering directory '/linux-sgx/sdk/trts/linux'
make[4]: Entering directory '/linux-sgx/external/sgx-emm'
make[4]: Leaving directory '/linux-sgx/external/sgx-emm'
make[3]: Leaving directory '/linux-sgx/sdk/trts/linux'
make[2]: Leaving directory '/linux-sgx/sdk/trts'
make -C tsetjmp/                            clean
make[2]: Entering directory '/linux-sgx/sdk/tsetjmp'
make[2]: Leaving directory '/linux-sgx/sdk/tsetjmp'
make -C tsafecrt/                           clean
make[2]: Entering directory '/linux-sgx/sdk/tsafecrt'
make[2]: Leaving directory '/linux-sgx/sdk/tsafecrt'
make -C gperftools/                         clean
make[2]: Entering directory '/linux-sgx/sdk/gperftools'
make[2]: Leaving directory '/linux-sgx/sdk/gperftools'
make -C tlibcrypto/                         clean
make[2]: Entering directory '/linux-sgx/sdk/tlibcrypto'
Makefile:49: *** recipe commences before first target.  Stop.
make[2]: Leaving directory '/linux-sgx/sdk/tlibcrypto'
make[1]: *** [Makefile.source:326: clean] Error 2
make[1]: Leaving directory '/linux-sgx/sdk'
make: *** [Makefile:483: clean] Error 2

The root cause for it is that make will treat every line begin with a tab as a recipe. Here is a minimum example showing how the error occurs:

# content of Makefile
ifeq (,)
	$(info hello)  # note that this line begins with a tab
endif

default:
	touch defaut
$ make
Makefile:2: *** recipe commences before first target.  Stop.

I can reproduce this error on ubuntu latest, with make 4.3 and commit 05851b2.

@SharzyL
Copy link
Author

SharzyL commented Apr 6, 2024

Rebased and signed off the commit now.

Signed-off-by: SharzyL <me@sharzy.in>
Copy link
Contributor

@haitaohuang haitaohuang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
Thanks

@haitaohuang haitaohuang requested review from llly and andyzyb April 8, 2024 04:17
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

Successfully merging this pull request may close these issues.

None yet

2 participants