Clean up Makefile in apps folder

99 views
Skip to first unread message

Xiang Xiao

unread,
Oct 1, 2019, 1:29:40 PM10/1/19
to NuttX

Thanks
Xiang
0001-apps-Makefile-remove-EXE_DIR-and-put-binary-into-bin.patch
0002-apps-Makefile-change-BIN_DIR-to-BINDIR-to-follow-nut.patch
0003-apps-Makefile-move-APPDIR-set-to-the-first-and-remov.patch
0004-remove-.PRECIOUS-if-Makefile-doesn-t-touch-libapps-L.patch
0005-wireless-Makefile-utilize-Directory.mk.patch

Gregory Nutt

unread,
Oct 1, 2019, 1:58:58 PM10/1/19
to nu...@googlegroups.com
All committed.  Thanks,

Greg


Xiang Xiao

unread,
Oct 2, 2019, 12:49:12 AM10/2/19
to NuttX
Minor fix to improve the portability.

On Wednesday, October 2, 2019 at 1:58:58 AM UTC+8, patacongo wrote:
All committed.  Thanks,

Greg


0001-Makefile-change-shell-pwd-to-CURDIR-since-pwd-doesn-.patch
0001-Makefile-change-shell-pwd-to-CURDIR-since-pwd-doesn-.patch

Gregory Nutt

unread,
Oct 2, 2019, 9:16:06 AM10/2/19
to nu...@googlegroups.com

Minor fix to improve the portability.

Committed with my recommended change:

-TOPDIR := ${shell pwd | sed -e 's/ /\\ /g'}
+TOPDIR := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}

I did not change the use of $(CURDIR) where the substitution was not done.  That is most likely a problem.  I never use paths with spaces in them.  I suspect that anyone using paths with spaces in them will see other problems.  They can all be fixed simply, but finding and fixing them all could be a problem.

Unfortunately, paths with spaces in them are VERY common on windows systems.  They are almost impossible to avoid.  Like "Program Files (x86)".

Greg

Xiang Xiao

unread,
Oct 2, 2019, 11:18:38 AM10/2/19
to NuttX
Yes, your change make more compatible.

Thanks
Xiang

Xiang Xiao

unread,
Oct 3, 2019, 3:43:59 PM10/3/19
to NuttX
More clean up for the loadable case.

Thanks
Xiang
0001-apps-Makefile-make-libapps-overwritable.patch
0002-Check-the-kernel-function-callable-by-BUILD_KERNEL-i.patch
0001-mkexport.sh-should-export-full-content-for-flat-buil.patch

Gregory Nutt

unread,
Oct 3, 2019, 5:41:57 PM10/3/19
to nu...@googlegroups.com

> More clean up for the loadable case.

Thanks committed.  Because of all of the LOADABLE changes, I really
don't have a feeling for what is going on with this now and I have no
real test case to verify everything.  So I am no really able to give a
proper review.

I do generally understand what is happening with the changes, but I am
not so certain.  I have to trust that you are taking the right steps and
verifying the changes.

Greg

Xiang Xiao

unread,
Oct 3, 2019, 11:02:22 PM10/3/19
to NuttX
Thanks for trust, I think the key change to loadable is:
1.BUILD_LOADABLE just mean we can build SOME binary into elf file, but don't have global effect like BUILD_KERNEL.
2. Individual application can decide whether become elf binary by CONFIG_XXX=m
So many test with BUILD_LOADABLE need change to:
1.BUILD_KERNEL if the code call some internal kernel function or
2.CONFIG_XXX=m if the code need XXX is an elf binary(e.g. system function spawn /bin/nsh).

Thanks
Xiang

Xiang Xiao

unread,
Oct 4, 2019, 9:04:54 AM10/4/19
to NuttX
Again more clean up for Makefile.
0001-clean-up-Makefile-under-apps-folder-no-function-chan.patch
0002-Change-some-program-from-tristate-to-bool.patch
0003-fsutils-passwd-use-named-semaphore-by-checking-CONFI.patch
0004-system-lzf-check-the-protection-by-CONFIG_SYSTEM_LZF.patch

Xiang Xiao

unread,
Oct 4, 2019, 9:13:06 AM10/4/19
to NuttX
Another one.
0001-fix-typo-error-in-testing-cxxtest.patch

patacongo

unread,
Oct 4, 2019, 9:51:41 AM10/4/19
to NuttX

I haven't applied your latest changes (I will do that soon).  Yesterday, everything build okay on Linux, but today on Cygwin I am seeing this error on anything I try to do.  For example:

$ make apps_distclean
Create .version
make[1]: Entering directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps'
make[2]: Entering directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps/builtin'
/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps/Application.mk:102: *** target pattern contains no '%'.  Stop.


and

$ make apps_distclean
make[2]: Entering directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps/builtin'
/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps/Application.mk:102: *** target pattern contains no '%'.  Stop.

Only those two directories cause the Application.mk error.  Any make target can cause the errors.

Greg

patacongo

unread,
Oct 4, 2019, 9:55:21 AM10/4/19
to NuttX
Nevermind.  I did

make distclean -i

And now everything is fine.  Without the -i I could not do the distclean.  But I think everything is okay is you start clean.

Greg

Gregory Nutt

unread,
Oct 4, 2019, 10:46:19 AM10/4/19
to nu...@googlegroups.com

> Again more clean up for Makefile.

I am looking at these patches now.  I am looking at
0002-Change-some-program-from-tristate-to-bool.patch. I agree that there
is an issue here when one file contains multiple entry entry points. 
These really should be separated into two programs.  This patches takes
a very hard approach:   It simply makes it impossible to use these
programs as modules.  Isn't that a little harsh?

The best solution would be to divide these into separate executables. 
But I appreciate that would be a lot of work in some cases since they
communicate through global variables.

Usually there are two entry points are something like START something
and STOP something.  Like the FTPD.  Wouldn't it be better to just
eliminate the STOP entry point and have only the START entry point. 
That is how it worked before if it were not a built in app.

#ifdef CONFIG_NSH_BUILTIN_APPS
 int ftpd_stop_main(int s_argc, char **s_argv)

And I think it would work the same way if it were a module.  I would
hate to lose the FTPTD program altoether.

Greg


Gregory Nutt

unread,
Oct 4, 2019, 10:56:46 AM10/4/19
to nu...@googlegroups.com
Couldn't you add the condition that with CONFIG_NETUTILS_FTPD == CONFIG_m

Also, in patch 0004, I will replace the explicit comparisons to '2' to
comparisons with CONFIG_m

Another NOTE with regard to 0003.  Not really important but the logic in
apps/futils/passwd is ALMOST replace with the new logic in
libs/libc/pwd.  It is needed now ONLY because the standard passwd
interfaces will not return the encrypted password.

Merging soon.  I think we will need to think more about 0002.

Greg


Gregory Nutt

unread,
Oct 4, 2019, 11:02:52 AM10/4/19
to nu...@googlegroups.com
On 10/4/2019 7:55 AM, patacongo wrote:
Nevermind.  I did

make distclean -i

And now everything is fine.  Without the -i I could not do the distclean.  But I think everything is okay is you start clean.

No, I am seeing the same errors with the ez80 makerlisp:nsh configuration.  Any idea what might be wrong?

$ make staging/libsched.lib
Create .version
Create version.h
include/nuttx/version.h.tmp include/nuttx/version.h differ: byte 394, line 10
LN: include/arch/chip to arch/z80/include/ez80
LN: /cygdrive/d/Spuda/Documents/projects/nuttx/master/nuttx/drivers/platform to /cygdrive/d/Spuda/Documents/projects/nuttx/master/nuttx/boards/z80/ez80/drivers
make[1]: Entering directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/nuttx/boards'
make[1]: Nothing to be done for 'dirlinks'.
make[1]: Leaving directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/nuttx/boards'


make[1]: Entering directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps'

make[2]: Entering directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps/platform'


/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps/Application.mk:102: *** target pattern contains no '%'.  Stop.

make[2]: Leaving directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps/platform'
make[1]: *** [Makefile:167: dirlinks] Error 2
make[1]: Leaving directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps'
make: *** [tools/Makefile.unix:375: dirlinks] Error 2

Gregory Nutt

unread,
Oct 4, 2019, 11:04:12 AM10/4/19
to nu...@googlegroups.com

> Again more clean up for Makefile.

I have applied all of the changes except 0002.  I will wait for your
feeback on my comments.

Greg


Gregory Nutt

unread,
Oct 4, 2019, 11:06:26 AM10/4/19
to nu...@googlegroups.com

> Another one.

Committed,

Greg


patacongo

unread,
Oct 4, 2019, 12:02:08 PM10/4/19
to NuttX

Noe, I am seeing the same errors with the ez80 makerlisp:nsh configuration.  Any idea what might be wrong?

$ make staging/libsched.lib

...

make[2]: Entering directory '/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps/platform'
/cygdrive/d/Spuda/Documents/projects/nuttx/master/apps/Application.mk:102: *** target pattern contains no '%'.  Stop.

 
I fixed that problem with this commit:

commit ddd5a18b0ce03e278fda746aec34b69c20608f67
Author: Gregory Nutt <gn...@nuttx.org>
Date:   Fri Oct 4 09:53:53 2019 -0600

    Application.mk:  Correct an error in PATH usage.  Use of toolchain path causes make errors.


Let me explain the problem.  This problem only occurs on Windows when you are using a POSIX environment (like Cygwin) but with a Windows native toolchain, in the above case, the ZiLOG ZDSII toolchain.

When you build on Linux, there is only one kind of path:  The standard POSIX path.  But when you build on Cygwin, there are two possibilities:  (1) I am building on Cygwin with a toolchain that I build under Cygwin (say using the NuttX buildroot).  This case is just like Linux, both Cygwin and GCC use the same paths.  The second case (2) is that I am building under Cygwin with a windows native toolchain that wants Windows system paths with C: at the front and backslashes.  This is the above case when building the eZ80 on Cygwin using the Windows ZDSII toolchain.

The variable BIN is used in both cases so it doesn't allow this separation.  So I added a new variable TOOLBIN which is usually just like BIN except when the Windows native toolchain is used, then it is a Windows path to the same file.  So then BIN is used whenever were are dealing with 'make' or other Cygwin utilities, but TOOLBIN must be used when dealing with the toolchain compiler, linker, archiver.

With that change, all of my problems go away.  Please do review the change.

Greg

Xiang Xiao

unread,
Oct 4, 2019, 1:25:28 PM10/4/19
to NuttX
I will reformat my patch try to:
1.split into two source code if possible
2.or comment out the stop version

patacongo

unread,
Oct 4, 2019, 6:30:32 PM10/4/19
to NuttX



I will reformat my patch try to:
1.split into two source code if possible
2.or comment out the stop version


I would suggest that you just review the options and just convert the ones are not to difficult.  The ones that depend on a global interface interface for example, would require a redesign.  I think your time is to valuable to be doing that and it is better to just disable those.

But if there is any "low hanging fruit" like the FTPD program, then it would be nice no to lose those entirely.

Greg

Xiang Xiao

unread,
Dec 13, 2019, 8:08:52 AM12/13/19
to NuttX
follow 0001-apps-Makefile-remove-EXE_DIR-and-put-binary-into-bin.patch to update the inital mount point from apps/exe/system to apps.

Thanks
Xiang
0001-sim-loadable-update-the-mount-point-of-hostfs.patch

Gregory Nutt

unread,
Dec 13, 2019, 9:30:46 AM12/13/19
to nu...@googlegroups.com

> follow 0001-apps-Makefile-remove-EXE_DIR-and-put-binary-into-bin.patch
> to update the inital mount point from apps/exe/system to apps.

Committed,

Greg


Reply all
Reply to author
Forward
0 new messages