Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .PHONY entries, add *.cpp dependencies for binary targets #596

Merged
merged 2 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ endif
deps:
@make -C src $@

.PHONY : deps

install:
ifneq ($(ROOTCHECK), 0)
@echo This must be run with root permissions.
Expand All @@ -54,3 +56,4 @@ else
echo ""; \
fi
endif
.PHONY : install
9 changes: 9 additions & 0 deletions config_repo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] $(DESTDIR)$(sysconfdir)/allsky/$@; \
fi
.PHONY : $(CONFIGFILES)

install: createDirs $(CONFIGFILES)
@echo `date +%F\ %R:%S` Setting up udev rules...
Expand All @@ -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) [email protected] ../config/$@; \
fi
.PHONY : $(CONFIGFILES)

install: createDirs $(CONFIGFILES)
@echo `date +%F\ %R:%S` Setting up udev rules...
Expand All @@ -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
17 changes: 13 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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...
Expand All @@ -109,17 +112,22 @@ sunwait:
@cp sunwait-src/sunwait .
@echo `date +%F\ %R:%S` Done.

capture:
capture:capture.cpp
@echo `date +%F\ %R:%S` Building $@ program...
@$(CC) [email protected] -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) [email protected] -o $@ $(CFLAGS) $(OPENCV)
@echo `date +%F\ %R:%S` Done.

startrails keogram:
keogram:keogram.cpp
@echo `date +%F\ %R:%S` Building $@ program...
@$(CC) [email protected] -o $@ $(CFLAGS) $(OPENCV)
@echo `date +%F\ %R:%S` Done.

startrails:startrails.cpp
@echo `date +%F\ %R:%S` Building $@ program...
@$(CC) [email protected] -o $@ $(CFLAGS) $(OPENCV)
@echo `date +%F\ %R:%S` Done.
Expand Down Expand Up @@ -171,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