From 4edfa9a0ac4567b478dfe6ff26400a39260e2149 Mon Sep 17 00:00:00 2001 From: "Michael J. Kidd" Date: Wed, 6 Oct 2021 10:47:58 -0700 Subject: [PATCH 1/2] Fixed source dependencies for 'make' to rebuild on code change --- src/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index a6c77c396..cb26d1274 100644 --- a/src/Makefile +++ b/src/Makefile @@ -109,17 +109,22 @@ sunwait: @cp sunwait-src/sunwait . @echo `date +%F\ %R:%S` Done. -capture: +capture:capture.cpp @echo `date +%F\ %R:%S` Building $@ program... @$(CC) $@.cpp -o $@ $(CFLAGS) $(OPENCV) -lASICamera2 $(USB) @echo `date +%F\ %R:%S` Done. -capture_RPiHQ: +capture_RPiHQ:capture_RPiHQ.cpp @echo `date +%F\ %R:%S` Building $@ program... @$(CC) $@.cpp -o $@ $(CFLAGS) $(OPENCV) @echo `date +%F\ %R:%S` Done. -startrails keogram: +keogram:keogram.cpp + @echo `date +%F\ %R:%S` Building $@ program... + @$(CC) $@.cpp -o $@ $(CFLAGS) $(OPENCV) + @echo `date +%F\ %R:%S` Done. + +startrails:startrails.cpp @echo `date +%F\ %R:%S` Building $@ program... @$(CC) $@.cpp -o $@ $(CFLAGS) $(OPENCV) @echo `date +%F\ %R:%S` Done. From cd7e92731f1d8110859c9c9ecfe39f808e4807a9 Mon Sep 17 00:00:00 2001 From: "Michael J. Kidd" Date: Wed, 6 Oct 2021 15:42:09 -0700 Subject: [PATCH 2/2] Made a bunch of PHONY stuff --- Makefile | 3 +++ config_repo/Makefile | 9 +++++++++ src/Makefile | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 94bf8fd13..e169a4a82 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,8 @@ endif deps: @make -C src $@ +.PHONY : deps + install: ifneq ($(ROOTCHECK), 0) @echo This must be run with root permissions. @@ -54,3 +56,4 @@ else echo ""; \ fi endif +.PHONY : install diff --git a/config_repo/Makefile b/config_repo/Makefile index 57673756a..ec61d4b3c 100644 --- a/config_repo/Makefile +++ b/config_repo/Makefile @@ -57,11 +57,14 @@ createDirs: @if [ ! -e $(DESTDIR)$(sysconfdir)/systemd/system ]; then mkdir -p $(DESTDIR)$(sysconfdir)/systemd/system; fi @if [ ! -e $(DESTDIR)$(sysconfdir)/udev/rules.d ]; then mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d; fi +.PHONY : createDirs + $(CONFIGFILES): @if [ ! -e $(DESTDIR)$(sysconfdir)/allsky/$@ ]; then \ echo `date +%F\ %R:%S` Copying default $@; \ install -m 0644 $@.repo $(DESTDIR)$(sysconfdir)/allsky/$@; \ fi +.PHONY : $(CONFIGFILES) install: createDirs $(CONFIGFILES) @echo `date +%F\ %R:%S` Setting up udev rules... @@ -80,15 +83,20 @@ remove_configs: @echo `date +%F\ %R:%S` Removing config path and files ../config @rm -rf ../config +.PHONY : remove_configs + createDirs: @echo `date +%F\ %R:%S` Creating directory structures... @if [ ! -e ../config ]; then mkdir -p ../config; chown $(SUDO_USER):$(SUDO_USER) ../config; fi +.PHONY : createDirs + $(CONFIGFILES): @if [ ! -e ../config/$@ ]; then \ echo `date +%F\ %R:%S` Copying default $@; \ install -m 0644 -o $(SUDO_USER) -g $(SUDO_USER) $@.repo ../config/$@; \ fi +.PHONY : $(CONFIGFILES) install: createDirs $(CONFIGFILES) @echo `date +%F\ %R:%S` Setting up udev rules... @@ -108,5 +116,6 @@ install: createDirs $(CONFIGFILES) @echo `date +%F\ %R:%S` Setting up home environment variable... @echo "export ALLSKY_HOME=$(PDIR)" > $(DESTDIR)$(sysconfdir)/profile.d/allsky.sh @echo `date +%F\ %R:%S` Copying default ftp-settings.sh +.PHONY : install endif # Package build check endif # Root check diff --git a/src/Makefile b/src/Makefile index cb26d1274..f02551b77 100644 --- a/src/Makefile +++ b/src/Makefile @@ -41,6 +41,8 @@ else @apt update && apt -y install libopencv-dev libusb-dev libusb-1.0-0-dev ffmpeg gawk lftp jq imagemagick endif +.PHONY : deps + USB=$(shell pkg-config --cflags --libs libusb-1.0) ifeq (,$(USB)) $(error Did not find USB Libraries, try 'make deps') @@ -99,6 +101,7 @@ CFLAGS += $(DEFS) $(ZWOSDK) @echo `date +%F\ %R:%S` nothing to do for $@ all:capture capture_RPiHQ startrails keogram sunwait +.PHONY : all sunwait: @echo `date +%F\ %R:%S` Initializing sunwait submodule... @@ -176,9 +179,10 @@ uninstall: fi endif # sudo / root check +.PHONY : install uninstall clean: rm -f capture capture_RPiHQ startrails keogram *.o *.a - +.PHONY : clean endif # Correct directory structure check