You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/03/22 21:47:31 UTC

[incubator-nuttx-apps] 04/04: Makefile: let install depend on the target binary

This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch pr136
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 4ea1eb78633753aa04883637e7a32cea7a964497
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Mar 16 17:12:16 2020 +0800

    Makefile: let install depend on the target binary
    
    to ensure the binary get built and install once
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 Application.mk                                    |  1 +
 Makefile                                          | 16 ++--------
 examples/elf/tests/errno/Makefile                 | 10 +++---
 examples/elf/tests/hello/Makefile                 | 10 +++---
 examples/elf/tests/helloxx/Makefile               | 38 +++++++++++++++++------
 examples/elf/tests/longjmp/Makefile               | 10 +++---
 examples/elf/tests/mutex/Makefile                 | 10 +++---
 examples/elf/tests/pthread/Makefile               | 10 +++---
 examples/elf/tests/signal/Makefile                | 10 +++---
 examples/elf/tests/struct/Makefile                | 10 +++---
 examples/elf/tests/task/Makefile                  | 10 +++---
 examples/module/drivers/chardev/Makefile          | 10 +++---
 examples/nxflat/tests/errno/Makefile              |  8 +++--
 examples/nxflat/tests/hello++/Makefile            | 21 ++++++++-----
 examples/nxflat/tests/hello/Makefile              |  8 +++--
 examples/nxflat/tests/longjmp/Makefile            |  8 +++--
 examples/nxflat/tests/mutex/Makefile              |  8 +++--
 examples/nxflat/tests/pthread/Makefile            |  8 +++--
 examples/nxflat/tests/signal/Makefile             |  8 +++--
 examples/nxflat/tests/struct/Makefile             |  8 +++--
 examples/nxflat/tests/task/Makefile               |  8 +++--
 examples/posix_spawn/filesystem/hello/Makefile    | 10 +++---
 examples/posix_spawn/filesystem/redirect/Makefile | 10 +++---
 examples/sotest/lib/modprint/Makefile             | 10 +++---
 examples/sotest/lib/sotest/Makefile               | 10 +++---
 examples/thttpd/content/hello/Makefile            |  8 +++--
 examples/thttpd/content/tasks/Makefile            |  8 +++--
 tools/mksymtab.sh                                 |  7 -----
 28 files changed, 174 insertions(+), 119 deletions(-)

diff --git a/Application.mk b/Application.mk
index 686dc2b..3187939 100644
--- a/Application.mk
+++ b/Application.mk
@@ -151,6 +151,7 @@ PROGLIST := $(addprefix $(BINDIR)$(DELIM),$(PROGLIST))
 PROGOBJ := $(MAINOBJ)
 
 $(PROGLIST): $(MAINOBJ)
+	$(Q) mkdir -p $(BINDIR)
 ifeq ($(WINTOOL),y)
 	$(call ELFLD,$(firstword $(PROGOBJ)),"${shell cygpath -w $(firstword $(PROGLIST))}")
 else
diff --git a/Makefile b/Makefile
index 6e90727..8f037c3 100644
--- a/Makefile
+++ b/Makefile
@@ -73,17 +73,12 @@ $(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
 
 ifeq ($(CONFIG_BUILD_KERNEL),y)
 
-.install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
-
-install: $(BINDIR) .install
-
-$(BINDIR):
-	$(Q) mkdir -p $(BINDIR)
+install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
 
 .import: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
 	$(Q) $(MAKE) install TOPDIR="$(TOPDIR)"
 
-import: $(BINDIR)
+import:
 	$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
 
 else
@@ -114,12 +109,7 @@ endif
 
 endif # !CONFIG_BUILD_LOADABLE
 
-.install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
-
-$(BINDIR):
-	$(Q) mkdir -p $(BINDIR)
-
-install: $(BINDIR) .install
+install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
 
 .import: $(BIN) install
 
diff --git a/examples/elf/tests/errno/Makefile b/examples/elf/tests/errno/Makefile
index ecac55f..ea7c54d 100644
--- a/examples/elf/tests/errno/Makefile
+++ b/examples/elf/tests/errno/Makefile
@@ -82,10 +82,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSIMG_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSIMG_DIR)
+	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
+
+install: $(FSIMG_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSIMG_DIR)
-	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
diff --git a/examples/elf/tests/hello/Makefile b/examples/elf/tests/hello/Makefile
index abee219..b5b3e85 100644
--- a/examples/elf/tests/hello/Makefile
+++ b/examples/elf/tests/hello/Makefile
@@ -82,10 +82,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSIMG_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSIMG_DIR)
+	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
+
+install: $(FSIMG_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSIMG_DIR)
-	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
diff --git a/examples/elf/tests/helloxx/Makefile b/examples/elf/tests/helloxx/Makefile
index 24a380c..3c4af09 100644
--- a/examples/elf/tests/helloxx/Makefile
+++ b/examples/elf/tests/helloxx/Makefile
@@ -67,15 +67,19 @@ LDLIBS += -lproxies
 endif
 
 BIN1 = hello++1
+ALL_BIN = $(FSIMG_DIR)/$(BIN1)
 BIN2 = hello++2
+ALL_BIN += $(FSIMG_DIR)/$(BIN2)
 ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y)
 BIN3 = hello++3
+ALL_BIN += $(FSIMG_DIR)/$(BIN3)
 ifeq ($(CONFIG_EXAMPLES_ELF_UCLIBCXX),y)
 BIN4 = hello++4
+ALL_BIN += $(FSIMG_DIR)/$(BIN4)
 BIN5 = hello++5
+ALL_BIN += $(FSIMG_DIR)/$(BIN5)
 endif
 endif
-ALL_BIN = $(BIN1) $(BIN2) $(BIN3) $(BIN4) $(BIN5)
 
 SRCS1 = $(BIN1).c
 OBJS1 = $(SRCS1:.c=$(OBJEXT))
@@ -147,22 +151,36 @@ $(BIN5): $(OBJS5)
 endif
 endif
 
-clean:
-	$(call DELFILE, $(BIN1))
-	$(call DELFILE, $(BIN2))
-	$(call DELFILE, $(BIN3))
-	$(call DELFILE, $(BIN4))
-	$(call DELFILE, $(BIN5))
-	$(call CLEAN)
-
-install: $(ALL_BIN)
+$(FSIMG_DIR)/$(BIN1): $(BIN1)
 	$(Q) mkdir -p $(FSIMG_DIR)
 	$(Q) install $(BIN1) $(FSIMG_DIR)/$(BIN1)
+
+$(FSIMG_DIR)/$(BIN2): $(BIN2)
+	$(Q) mkdir -p $(FSIMG_DIR)
 	$(Q) install $(BIN2) $(FSIMG_DIR)/$(BIN2)
+
 ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y)
+$(FSIMG_DIR)/$(BIN3): $(BIN3)
+	$(Q) mkdir -p $(FSIMG_DIR)
 	$(Q) install $(BIN3) $(FSIMG_DIR)/$(BIN3)
+
 ifeq ($(CONFIG_EXAMPLES_ELF_UCLIBCXX),y)
+$(FSIMG_DIR)/$(BIN4): $(BIN4)
+	$(Q) mkdir -p $(FSIMG_DIR)
 	$(Q) install $(BIN4) $(FSIMG_DIR)/$(BIN4)
+
+$(FSIMG_DIR)/$(BIN5): $(BIN5)
+	$(Q) mkdir -p $(FSIMG_DIR)
 	$(Q) install $(BIN5) $(FSIMG_DIR)/$(BIN5)
 endif
 endif
+
+install: $(ALL_BIN)
+
+clean:
+	$(call DELFILE, $(BIN1))
+	$(call DELFILE, $(BIN2))
+	$(call DELFILE, $(BIN3))
+	$(call DELFILE, $(BIN4))
+	$(call DELFILE, $(BIN5))
+	$(call CLEAN)
diff --git a/examples/elf/tests/longjmp/Makefile b/examples/elf/tests/longjmp/Makefile
index c15ef4a..c943491 100644
--- a/examples/elf/tests/longjmp/Makefile
+++ b/examples/elf/tests/longjmp/Makefile
@@ -82,10 +82,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSIMG_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSIMG_DIR)
+	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
+
+install: $(FSIMG_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSIMG_DIR)
-	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
diff --git a/examples/elf/tests/mutex/Makefile b/examples/elf/tests/mutex/Makefile
index 53bf2ac..b864d67 100644
--- a/examples/elf/tests/mutex/Makefile
+++ b/examples/elf/tests/mutex/Makefile
@@ -82,10 +82,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSIMG_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSIMG_DIR)
+	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
+
+install: $(FSIMG_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSIMG_DIR)
-	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
diff --git a/examples/elf/tests/pthread/Makefile b/examples/elf/tests/pthread/Makefile
index 26aa9f9..742c811 100644
--- a/examples/elf/tests/pthread/Makefile
+++ b/examples/elf/tests/pthread/Makefile
@@ -82,10 +82,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSIMG_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSIMG_DIR)
+	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
+
+install: $(FSIMG_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSIMG_DIR)
-	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
diff --git a/examples/elf/tests/signal/Makefile b/examples/elf/tests/signal/Makefile
index e582c32..e2f21ff 100644
--- a/examples/elf/tests/signal/Makefile
+++ b/examples/elf/tests/signal/Makefile
@@ -82,10 +82,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSIMG_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSIMG_DIR)
+	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
+
+install: $(FSIMG_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSIMG_DIR)
-	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
diff --git a/examples/elf/tests/struct/Makefile b/examples/elf/tests/struct/Makefile
index cdf32c0..bf7faeb 100644
--- a/examples/elf/tests/struct/Makefile
+++ b/examples/elf/tests/struct/Makefile
@@ -83,10 +83,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSIMG_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSIMG_DIR)
+	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
+
+install: $(FSIMG_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSIMG_DIR)
-	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
diff --git a/examples/elf/tests/task/Makefile b/examples/elf/tests/task/Makefile
index c46a251..3ebaa3b 100644
--- a/examples/elf/tests/task/Makefile
+++ b/examples/elf/tests/task/Makefile
@@ -82,10 +82,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSIMG_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSIMG_DIR)
+	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
+
+install: $(FSIMG_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSIMG_DIR)
-	$(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
diff --git a/examples/module/drivers/chardev/Makefile b/examples/module/drivers/chardev/Makefile
index 5b290d5..1144f0c 100644
--- a/examples/module/drivers/chardev/Makefile
+++ b/examples/module/drivers/chardev/Makefile
@@ -88,10 +88,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDMODULEFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSROOT_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSROOT_DIR)
+	$(Q) install $(BIN) $(FSROOT_DIR)/$(BIN)
+
+install: $(FSROOT_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install: $(BIN)
-	$(Q) mkdir -p $(FSROOT_DIR)
-	$(Q) install $(BIN) $(FSROOT_DIR)/$(BIN)
diff --git a/examples/nxflat/tests/errno/Makefile b/examples/nxflat/tests/errno/Makefile
index b63af3f..0014e66 100644
--- a/examples/nxflat/tests/errno/Makefile
+++ b/examples/nxflat/tests/errno/Makefile
@@ -69,12 +69,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/nxflat/tests/hello++/Makefile b/examples/nxflat/tests/hello++/Makefile
index d148360..ea2b8eb 100644
--- a/examples/nxflat/tests/hello++/Makefile
+++ b/examples/nxflat/tests/hello++/Makefile
@@ -39,7 +39,6 @@ BIN1			= hello++1
 BIN2			= hello++2
 BIN3			= hello++3
 #BIN4			= hello++4
-ALL_BIN			= $(BIN1) $(BIN2) $(BIN3) $(BIN4)
 
 R1SRCS1			= $(BIN1).c
 R1OBJS1			= $(R1SRCS1:.c=.o)
@@ -162,6 +161,20 @@ $(BIN3): $(BIN3).r2
 #	@echo "LD: $<"
 #	$(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN1): $(BIN1)
+	$(Q) install -D $(BIN1) $(ROMFS_DIR)/$(BIN1)
+
+$(ROMFS_DIR)/$(BIN2): $(BIN2)
+	$(Q) install -D $(BIN2) $(ROMFS_DIR)/$(BIN2)
+
+$(ROMFS_DIR)/$(BIN3): $(BIN3)
+	$(Q) install -D $(BIN3) $(ROMFS_DIR)/$(BIN3)
+
+#$(ROMFS_DIR)/$(BIN4): $(BIN4)
+#	$(Q) install -D $(BIN4) $(ROMFS_DIR)/$(BIN4)
+
+install: $(ROMFS_DIR)/$(BIN1) $(ROMFS_DIR)/$(BIN2) $(ROMFS_DIR)/$(BIN3)
+
 clean:
 	$(call DELFILE, $(BIN1))
 	$(call DELFILE, $(BIN2))
@@ -174,9 +187,3 @@ clean:
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install: $(ALL_BIN)
-	$(Q) install -D $(BIN1) $(ROMFS_DIR)/$(BIN1)
-	$(Q) install -D $(BIN2) $(ROMFS_DIR)/$(BIN2)
-	$(Q) install -D $(BIN3) $(ROMFS_DIR)/$(BIN3)
-#	$(Q) install -D $(BIN4) $(ROMFS_DIR)/$(BIN4)
diff --git a/examples/nxflat/tests/hello/Makefile b/examples/nxflat/tests/hello/Makefile
index 040e377..eb60dd6 100644
--- a/examples/nxflat/tests/hello/Makefile
+++ b/examples/nxflat/tests/hello/Makefile
@@ -69,12 +69,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/nxflat/tests/longjmp/Makefile b/examples/nxflat/tests/longjmp/Makefile
index 0e48afa..8a98467 100644
--- a/examples/nxflat/tests/longjmp/Makefile
+++ b/examples/nxflat/tests/longjmp/Makefile
@@ -69,12 +69,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/nxflat/tests/mutex/Makefile b/examples/nxflat/tests/mutex/Makefile
index 855aca5..b53a499 100644
--- a/examples/nxflat/tests/mutex/Makefile
+++ b/examples/nxflat/tests/mutex/Makefile
@@ -69,12 +69,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/nxflat/tests/pthread/Makefile b/examples/nxflat/tests/pthread/Makefile
index 38432f4..1649410 100644
--- a/examples/nxflat/tests/pthread/Makefile
+++ b/examples/nxflat/tests/pthread/Makefile
@@ -69,12 +69,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/nxflat/tests/signal/Makefile b/examples/nxflat/tests/signal/Makefile
index 5b08e99..2211747 100644
--- a/examples/nxflat/tests/signal/Makefile
+++ b/examples/nxflat/tests/signal/Makefile
@@ -69,12 +69,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/nxflat/tests/struct/Makefile b/examples/nxflat/tests/struct/Makefile
index 94f1077..77cd7e7 100644
--- a/examples/nxflat/tests/struct/Makefile
+++ b/examples/nxflat/tests/struct/Makefile
@@ -71,12 +71,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/nxflat/tests/task/Makefile b/examples/nxflat/tests/task/Makefile
index 177bc75..e532be4 100644
--- a/examples/nxflat/tests/task/Makefile
+++ b/examples/nxflat/tests/task/Makefile
@@ -69,12 +69,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/posix_spawn/filesystem/hello/Makefile b/examples/posix_spawn/filesystem/hello/Makefile
index 3c9d0fc..fc316fc 100644
--- a/examples/posix_spawn/filesystem/hello/Makefile
+++ b/examples/posix_spawn/filesystem/hello/Makefile
@@ -51,11 +51,13 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, *.dSYM)
 	$(call CLEAN)
-
-install: $(BIN)
-	$(Q) mkdir -p $(ROMFS_DIR)
-	$(Q) install $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/posix_spawn/filesystem/redirect/Makefile b/examples/posix_spawn/filesystem/redirect/Makefile
index 9b30d4b..47b543d 100644
--- a/examples/posix_spawn/filesystem/redirect/Makefile
+++ b/examples/posix_spawn/filesystem/redirect/Makefile
@@ -51,11 +51,13 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDELFFLAGS) -o $@ $^
 
+$(ROMFS_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(ROMFS_DIR)
+	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
+
+install: $(ROMFS_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, *.dSYM)
 	$(call CLEAN)
-
-install: $(BIN)
-	$(Q) mkdir -p $(ROMFS_DIR)
-	$(Q) install -m 0755 $(BIN) $(ROMFS_DIR)/$(BIN)
diff --git a/examples/sotest/lib/modprint/Makefile b/examples/sotest/lib/modprint/Makefile
index 3c77986..96e230e 100644
--- a/examples/sotest/lib/modprint/Makefile
+++ b/examples/sotest/lib/modprint/Makefile
@@ -88,10 +88,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDMODULEFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSROOT_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSROOT_DIR)
+	$(Q) install $(BIN) $(FSROOT_DIR)/$(BIN)
+
+install: $(FSROOT_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSROOT_DIR)
-	$(Q) install $(BIN) $(FSROOT_DIR)/$(BIN)
diff --git a/examples/sotest/lib/sotest/Makefile b/examples/sotest/lib/sotest/Makefile
index 45c9ac6..c0ac2e4 100644
--- a/examples/sotest/lib/sotest/Makefile
+++ b/examples/sotest/lib/sotest/Makefile
@@ -88,10 +88,12 @@ $(BIN): $(OBJS)
 	@echo "LD: $<"
 	$(Q) $(LD) $(LDMODULEFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
 
+$(FSROOT_DIR)/$(BIN): $(BIN)
+	$(Q) mkdir -p $(FSROOT_DIR)
+	$(Q) install $(BIN) $(FSROOT_DIR)/$(BIN)
+
+install: $(FSROOT_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call CLEAN)
-
-install:
-	$(Q) mkdir -p $(FSROOT_DIR)
-	$(Q) install $(BIN) $(FSROOT_DIR)/$(BIN)
diff --git a/examples/thttpd/content/hello/Makefile b/examples/thttpd/content/hello/Makefile
index 226cbd0..dcdcb99 100644
--- a/examples/thttpd/content/hello/Makefile
+++ b/examples/thttpd/content/hello/Makefile
@@ -70,12 +70,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(CGI_DIR)/$(BIN): $(BIN)
+	$(Q) install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN)
+
+install: $(CGI_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN)
diff --git a/examples/thttpd/content/tasks/Makefile b/examples/thttpd/content/tasks/Makefile
index de3d576..f0304fc 100644
--- a/examples/thttpd/content/tasks/Makefile
+++ b/examples/thttpd/content/tasks/Makefile
@@ -73,12 +73,14 @@ $(BIN): $(BIN).r2
 	@echo "LD: $<"
 	$(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^
 
+$(CGI_DIR)/$(BIN): $(BIN)
+	$(Q) install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN)
+
+install: $(CGI_DIR)/$(BIN)
+
 clean:
 	$(call DELFILE, $(BIN))
 	$(call DELFILE, $(R2SRC))
 	$(call DELFILE, *.r1)
 	$(call DELFILE, *.r2)
 	$(call CLEAN)
-
-install:
-	$(Q) install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN)
diff --git a/tools/mksymtab.sh b/tools/mksymtab.sh
index 1cc616a..f8414d6 100755
--- a/tools/mksymtab.sh
+++ b/tools/mksymtab.sh
@@ -48,13 +48,6 @@ if [ -z "$dir" ]; then
   exit 1
 fi
 
-if [ ! -d "$dir" ]; then
-  echo "ERROR: Directory $dir does not exist"
-  echo ""
-  echo $usage
-  exit 1
-fi
-
 # Get the output file name
 
 outfile=$2