From 5b26c370da5c4244955010af2eed5a4faa43e8ac Mon Sep 17 00:00:00 2001 From: jakcron Date: Tue, 7 Aug 2018 14:00:09 +0800 Subject: [PATCH] Updated top level makefile to include prog and lib level makefile logic. --- lib/makefile | 10 ---------- makefile | 19 +++++++++++++++---- programs/makefile | 14 -------------- 3 files changed, 15 insertions(+), 28 deletions(-) delete mode 100644 lib/makefile delete mode 100644 programs/makefile diff --git a/lib/makefile b/lib/makefile deleted file mode 100644 index c39f843..0000000 --- a/lib/makefile +++ /dev/null @@ -1,10 +0,0 @@ -LIBS = libfnd libpolarssl liblz4 libcrypto libcompress libes libpki libhac libhac-hb -main: build - -rebuild: clean build - -build: - @$(foreach lib,$(LIBS), cd $(lib) && $(MAKE) && cd ..;) - -clean: - @$(foreach lib,$(LIBS), cd $(lib) && $(MAKE) clean && cd ..;) \ No newline at end of file diff --git a/makefile b/makefile index 2e12b4c..e6acda4 100644 --- a/makefile +++ b/makefile @@ -1,11 +1,22 @@ +PROJECT_DIR = $(CURDIR) +LIB_DIR = $(PROJECT_DIR)/lib +PROGRAM_DIR = $(PROJECT_DIR)/programs +BIN_DIR = $(PROJECT_DIR)/bin + +LIBS = libfnd libpolarssl liblz4 libcrypto libcompress libes libpki libhac libhac-hb +PROGS = nstool + main: build rebuild: clean build build: - cd lib && $(MAKE) && cd .. - cd programs && $(MAKE) && cd .. + mkdir -p $(BIN_DIR) + @$(foreach lib,$(LIBS), cd $(LIB_DIR)/$(lib) && $(MAKE) && cd $(PROJECT_DIR);) + @$(foreach prog,$(PROGS), cd $(PROGRAM_DIR)/$(prog) && $(MAKE) && cd $(PROJECT_DIR) && cp -r $(PROGRAM_DIR)/$(prog)/bin/* $(BIN_DIR);) + clean: - cd lib && $(MAKE) clean && cd .. - cd programs && $(MAKE) clean && cd .. \ No newline at end of file + rm -rf $(BIN_DIR) + @$(foreach lib,$(LIBS), cd $(LIB_DIR)/$(lib) && $(MAKE) clean && cd $(PROJECT_DIR);) + @$(foreach prog,$(PROGS), cd $(PROGRAM_DIR)/$(prog) && $(MAKE) clean && cd $(PROJECT_DIR);) \ No newline at end of file diff --git a/programs/makefile b/programs/makefile deleted file mode 100644 index 533c7af..0000000 --- a/programs/makefile +++ /dev/null @@ -1,14 +0,0 @@ -PROGS = nstool -BIN_DIR = "../bin" - -main: build - -rebuild: clean build - -build: - mkdir -p $(BIN_DIR) - @$(foreach prog,$(PROGS), cd $(prog) && $(MAKE) && cd .. && cp -r $(prog)/bin/* $(BIN_DIR);) - -clean: - @$(foreach prog,$(PROGS), cd $(prog) && $(MAKE) clean && cd ..;) - rm -rf $(BIN_DIR) \ No newline at end of file