From eaff9f8825914c970de3afb0b2ad393a24d84b04 Mon Sep 17 00:00:00 2001 From: junmin kim Date: Mon, 27 Mar 2017 22:09:31 -0700 Subject: [PATCH] Use directory.mk for recursive dir makefiles Update nuttx-7.17 app structure --- apps/Directory.mk | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ apps/examples/Makefile | 42 ++---------------------- apps/netutils/Makefile | 39 ++--------------------- apps/system/Makefile | 48 ++-------------------------- 4 files changed, 94 insertions(+), 121 deletions(-) create mode 100644 apps/Directory.mk diff --git a/apps/Directory.mk b/apps/Directory.mk new file mode 100644 index 0000000..62eda15 --- /dev/null +++ b/apps/Directory.mk @@ -0,0 +1,86 @@ +########################################################################### +# +# Copyright 2017 Samsung Electronics All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +########################################################################### +############################################################################ +# apps/Directory.mk +# +# Copyright (C) 2011-2015 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config # Current configuration +include $(APPDIR)/Make.defs + +# Sub-directories + +SUBDIRS = $(dir $(wildcard */Makefile)) + +all: nothing + +.PHONY: nothing context depend clean distclean + +define SDIR_template +$(1)_$(2): + $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" +endef + +$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),context))) +$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend))) +$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean))) +$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) + +nothing: + +install: + +context: $(foreach SDIR, $(SUBDIRS), $(SDIR)_context) + +depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend) + +clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean) + +distclean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean) + +-include Make.dep diff --git a/apps/examples/Makefile b/apps/examples/Makefile index 5f8cdb6..2412200 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright 2016 Samsung Electronics All Rights Reserved. +# Copyright 2016-2017 Samsung Electronics All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ ############################################################################ # apps/examples/Makefile # -# Copyright (C) 2011-2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2015 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -50,40 +50,4 @@ # ############################################################################ --include $(TOPDIR)/.config # Current configuration - -# Sub-directories - -SUBDIRS = artik_demo dtls_client dtls_server fota_sample hello hello_tash -SUBDIRS += helloxx iotivity iperf kernel_sample mdns_test mpu nettest -SUBDIRS += ntpclient_test proc_test select_test sysio_test telnetd testcase -SUBDIRS += tls_client tls_selftest tls_server wakaama_client webclient -SUBDIRS += webserver websocket workqueue - -all: nothing - -.PHONY: nothing context depend clean distclean - -define SDIR_template -$(1)_$(2): - $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -endef - -$(foreach SDIR, $(CNTXTDIRS), $(eval $(call SDIR_template,$(SDIR),context))) -$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend))) -$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean))) -$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) - -nothing: - -install: - -context: $(foreach SDIR, $(CNTXTDIRS), $(SDIR)_context) - -depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend) - -clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean) - -distclean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean) - --include Make.dep +include $(APPDIR)/Directory.mk diff --git a/apps/netutils/Makefile b/apps/netutils/Makefile index c50ab0f..02533f1 100644 --- a/apps/netutils/Makefile +++ b/apps/netutils/Makefile @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright 2016 Samsung Electronics All Rights Reserved. +# Copyright 2016-2017 Samsung Electronics All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ ############################################################################ # apps/netutils/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -50,37 +50,4 @@ # ############################################################################ --include $(TOPDIR)/.config # Current configuration - -# Sub-directories - -SUBDIRS = json codecs -ifeq ($(CONFIG_NET),y) -SUBDIRS += netlib dhcpc dhcpd ftpd smtp telnetd -SUBDIRS += webserver webclient websocket tftpc xmlrpc ntpclient mdns -endif - -all: nothing - -.PHONY: nothing context depend clean distclean - -define SDIR_template -$(1)_$(2): - $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -endef - -$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend))) -$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean))) -$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) - -nothing: - -install: - -context: - -depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend) - -clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean) - -distclean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean) +include $(APPDIR)/Directory.mk diff --git a/apps/system/Makefile b/apps/system/Makefile index 9c89668..d7f45d7 100644 --- a/apps/system/Makefile +++ b/apps/system/Makefile @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright 2016 Samsung Electronics All Rights Reserved. +# Copyright 2016-2017 Samsung Electronics All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,48 +50,4 @@ # ############################################################################ --include $(TOPDIR)/.config # Current configuration - -# Sub-directories containing system tasks/libraries - -SUBDIRS = cle cu flash_eraseall fota_hal i2c inifile init -SUBDIRS += install mdio netdb poweroff prun ramtest ramtron readline -SUBDIRS += sysinfo utils vi - -# Create the list of installed runtime modules (INSTALLED_DIRS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) -define ADD_DIRECTORY - INSTALLED_DIRS += $(if $(wildcard .\$1\Makefile),$1,) -endef -else -define ADD_DIRECTORY - INSTALLED_DIRS += $(if $(wildcard ./$1/Makefile),$1,) -endef -endif - -$(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR)))) - -all: nothing -.PHONY: nothing context depend clean distclean - -define SDIR_template -$(1)_$(2): - $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -endef - -$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),depend))) -$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),clean))) -$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) - -nothing: - -install: - -context: - -depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend) - -clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean) - -distclean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) +include $(APPDIR)/Directory.mk -- 2.7.4