summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDominic Radermacher <blip@mockmoon-cybernetics.ch>2018-04-21 15:50:03 +0200
committerDominic Radermacher <blip@mockmoon-cybernetics.ch>2018-04-21 15:50:03 +0200
commitae9333e21ab1eaff37ec8fefa0e9899d13349184 (patch)
treeb2a197878ae7a6ae23d395657846ee4a1fa65f80 /Makefile
initial commit, turning LEDs off is workingv0.9
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 44 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ee08d4d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+ECHO = /bin/echo -e
+SHELL = /bin/sh
+RM = /bin/rm -f
+CC = gcc
+STRIP = strip
+
+GIT_VERSION := $(shell git --no-pager describe --tags --dirty |sed 's/\([^-]*-g\)/r\1/;s/-/./g')
+
+CFLAGS = -g -Os -std=c11 -I./include -Wall -Wstrict-prototypes -Wconversion
+CFLAGS += -DVERSION=\"$(GIT_VERSION)\"
+CFLAGS += -Wmissing-prototypes -Wshadow -Wextra -Wunused
+LDFLAGS = -lusb-1.0
+
+PROGS = lan7800-led-ctl
+
+all: $(PROGS)
+
+clean:
+ $(RM) src/*.o
+tidy:
+ $(RM) src/*.o $(PROGS)
+
+install: $(PROGS)
+ @$(ECHO) "\t==> Installing programs to $(DESTDIR)/usr/bin"
+ @install -m 0755 -d $(DESTDIR)/usr/bin
+ @install -m 0755 -t $(DESTDIR)/usr/bin $(PROGS)
+
+pack:
+ @$(ECHO) "Cleaning up ..." ; \
+ $(RM) src/*.o $(PROGS)
+ @$(ECHO) "Creating package ..." ; \
+ cd .. ; \
+ tar c -J -f lan7800-led-ctl-$(GIT_VERSION).tar.xz lan7800-led-ctl
+
+# Generic instructions
+src/%.o: src/%.c
+ @$(ECHO) "\t--> Compiling `basename $<`"
+ @$(CC) $(CFLAGS) -c $< -o $@
+
+# Specific programs
+lan7800-led-ctl: src/lan7800-led-ctl.o
+ @$(ECHO) "\t==> Linking objects to output file $@ $(GIT_VERSION)\n"
+ @$(CC) $(CFLAGS) $(LDFLAGS) $+ -o $@
+ @$(STRIP) $@