makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. SRC = src
  2. CC = g++
  3. CFLAGS = -g -Wall -fpermissive
  4. LIBS = -lsqlite3 -pthread -lpigpio -lrt
  5. _DEPS = common.h daemon.h ini.h \
  6. INIReader.h log.h RCSwitch.h server.h \
  7. discovery.h
  8. DEPS = $(patsubst %,$(SRC)/%,$(_DEPS))
  9. _OBJ = common.o log.o server.o \
  10. RCSwitch.o daemon.o ini.o \
  11. INIReader.o discovery.o
  12. OBJ = $(patsubst %,$(SRC)/%,$(_OBJ))
  13. all: kisslight
  14. %.o: %.cpp $(DEPS)
  15. $(CC) -c -o $@ $< $(CFLAGS)
  16. kisslight: $(OBJ)
  17. $(CC) $(CFLAGS) $(LIBS) $^ -o $@
  18. install: kisslight
  19. cp resources/kisslight.ini /etc/
  20. mkdir /etc/kisslight
  21. cp resources/kisslight.service /etc/systemd/system/
  22. cp kisslight /usr/bin/
  23. mkdir /var/lib/kisslight
  24. sqlite3 /var/lib/kisslight/kisslight.db < resources/server-db.sql
  25. systemctl daemon-reload
  26. systemctl start kisslight.service
  27. systemctl enable kisslight.service
  28. uninstall:
  29. systemctl stop kisslight.service
  30. systemctl disable kisslight.service
  31. rm -f /etc/kisslight.ini /etc/systemd/system/kisslight.service /usr/bin/kisslight
  32. rm -rf /var/lib/kisslight
  33. systemctl daemon-reload
  34. client: client/kl-client.go
  35. go build client/kl-client.go
  36. client-install: client
  37. mkdir -p /home/$(USER)/.config/kisslight
  38. cp client/kl-client.ini /home/$(USER)/.config/kisslight/
  39. sudo cp kl-client /usr/bin/
  40. client-uninstall:
  41. rm -r /home/$(USER)/.config/kisslight
  42. sudo rm /usr/bin/kl-client
  43. clean:
  44. rm -f $(SRC)/*.o kl-client kisslight