Skip to content

Commit

Permalink
Merge pull request #596 from linuxkidd/master
Browse files Browse the repository at this point in the history
Add .PHONY entries, add *.cpp dependencies for binary targets
  • Loading branch information
ckuethe authored Oct 7, 2021
2 parents 6a57f41 + cd7e927 commit dd50e72
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
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 $@.repo $(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) $@.repo ../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) $@.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.
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

0 comments on commit dd50e72

Please sign in to comment.