diff options
author | Dominic Radermacher <blip@mockmoon-cybernetics.ch> | 2020-05-04 18:54:19 +0200 |
---|---|---|
committer | Dominic Radermacher <blip@mockmoon-cybernetics.ch> | 2020-05-04 18:54:19 +0200 |
commit | 2d51527baa2632a8882301102c60163d76aa71f3 (patch) | |
tree | 82a43f63c43597d49a56b73c3e39906f5008e2f8 | |
parent | 36f32595d7fe5afed7f3c78bc5445f157cacd1f8 (diff) |
Cleanup Makefile, add --version info
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | include/lan951x-led-ctl.h | 1 | ||||
-rw-r--r-- | src/lan951x-led-ctl.c | 10 |
3 files changed, 12 insertions, 8 deletions
@@ -21,17 +21,10 @@ tidy: $(RM) src/*.o $(PROGS) install: $(PROGS) - @$(ECHO) "\t==> Installing programs to $(DESTDIR)/usr/bin" + @$(ECHO) "\t==> Installing programs to $(DESTDIR)/bin" @install -m 0755 -d $(DESTDIR)/bin @install -m 0755 -t $(DESTDIR)/bin $(PROGS) -pack: - @$(ECHO) "Cleaning up ..." ; \ - $(RM) src/*.o $(PROGS) - @$(ECHO) "Creating package ..." ; \ - cd .. ; \ - tar c -J -f lan951x-led-ctl-$$GIT_VERSION.tar.xz lan951x-led-ctl - # Generic instructions src/%.o: src/%.c @$(ECHO) "\t--> Compiling `basename $<`" diff --git a/include/lan951x-led-ctl.h b/include/lan951x-led-ctl.h index 18249a8..8027020 100644 --- a/include/lan951x-led-ctl.h +++ b/include/lan951x-led-ctl.h @@ -55,6 +55,7 @@ #define MODE_ERR -1 void usage(void); +void about(void); int ledmode(const char* str); int parse_args(int argc, char** argv); libusb_device_handle* lan951x_open(int vid, int pid); diff --git a/src/lan951x-led-ctl.c b/src/lan951x-led-ctl.c index c072805..fe95143 100644 --- a/src/lan951x-led-ctl.c +++ b/src/lan951x-led-ctl.c @@ -100,6 +100,14 @@ void usage(void) exit(1); } +void about(void) +{ + printf("lan951x-led-ctl %s programmed by Dominic Radermacher\n", VERSION); + printf("For further info or latest version see\n"); + printf("https://mockmoon-cybernetics.ch/computer/raspberry-pi/lan951x-led-ctl/\n"); + exit(1); +} + int parse_args(int argc, char **argv) { int i; @@ -115,6 +123,8 @@ int parse_args(int argc, char **argv) } else if (strncmp(p, "--spd=", 6) == 0) { led_arr[SPDIDX] = ledmode(p+6); printf("setting SPD LED to status %i\n", led_arr[SPDIDX]); + } else if (strcmp(p, "--version") == 0) { + about(); } else { usage(); } |