From 6603bec6ddc5e877d081d0438da128c656f11738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Fri, 18 Jun 2021 08:49:05 +0200 Subject: [PATCH] fix: make Makefile delete old files if architecture is switched --- .gitignore | 4 ++++ Makefile | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 762677dc000adabbe04201941402f614b0d07a7d..184f8c72c7fbbac8cf6e3ed929ab11a6985e42eb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ compile_commands.json ignore bin/ obj/ + +depend +.computer +.arm \ No newline at end of file diff --git a/Makefile b/Makefile index 593e448bee6758a73867c13e683443cc20b0c6a1..d749e3ddaabe7228faef250af21f39c4686b3f8a 100644 --- a/Makefile +++ b/Makefile @@ -20,12 +20,27 @@ SSH_OPTIONS+=-i ~/.ssh/mzapo-root-key #SSH_OPTIONS=-i /opt/zynq/ssh-connect/mzapo-root-key #SSH_OPTIONS=-o 'ProxyJump=ctu_login@postel.felk.cvut.cz' -all: image-viewer FORCE +IMAGE_VIEWER=./bin/image-viewer +LIB_PHERIPHERALS=./bin/lib_pheripherals.so -image-viewer: FORCE lib-pheripherals +ifdef ($(COMPUTER)) +DEPENDENCIES=./.computer +else +DEPENDENCIES=./.arm +endif + +all: $(DEPENDENCIES) image-viewer + +image-viewer: $(IMAGE_VIEWER) +lib-pheripherals: $(LIB_PHERIPHERALS) + +$(IMAGE_VIEWER): $(DEPENDENCIES) lib-pheripherals @make -C image-viewer -lib-pheripherals: FORCE +$(DEPENDENCIES): clean + touch $(DEPENDENCIES) + +$(LIB_PHERIPHERALS): @make -C lib-pheripherals copy-executable: all @@ -41,6 +56,7 @@ clean: @make -C image-viewer clean @make -C lib-pheripherals clean $(RM) -rf $(BIN_DIR) + $(RM) -rf ./.computer ./.arm FORCE: ;