blob: 8880acaa26efbec479113efb3991eca9f007f735 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
ECHO = /bin/echo -e
SHELL = /bin/sh
RM = /bin/rm -f
CC = gcc
STRIP = strip
CFLAGS = -g -Os -std=c11 -I./include -Wall -Wstrict-prototypes -Wconversion
CFLAGS += -Wmissing-prototypes -Wshadow -Wextra -Wunused
LDFLAGS = -lusb-1.0
PROGS = lan951x-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 ..." ; \
VERSION=`cat include/lan951x-led-ctl.h |grep VERSION |cut -d "\"" -f 2` ; \
cd .. ; \
tar c -J -f lan951x-led-ctl-$$VERSION.tar.xz lan951x-led-ctl
# Generic instructions
src/%.o: src/%.c
@$(ECHO) "\t--> Compiling `basename $<`"
@$(CC) $(CFLAGS) -c $< -o $@
# Specific programs
lan951x-led-ctl: src/lan951x-led-ctl.o
@$(ECHO) "\t==> Linking objects to output file $@"
@$(CC) $(CFLAGS) $(LDFLAGS) $+ -o $@
@$(STRIP) $@
|