-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
84 lines (66 loc) · 2.27 KB
/
Makefile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# Copyright 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# Make is silent per default, but 'make V=1' will show all compiler calls.
Q:=@
ifneq ($(V),1)
ifneq ($(Q),)
.SILENT:
endif
endif
CFLAGS ?= -O2 -g -fomit-frame-pointer
CFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0)
CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
CFLAGS += -Wwrite-strings -Wredundant-decls -Wstrict-aliasing -Wshadow -Wextra
CFLAGS += -Wno-unused-but-set-variable
CFLAGS += -DXZ_USE_CRC64 -DXZ_DEC_ANY_CHECK -Ixz
LDFLAGS ?=
LDFLAGS += $(shell $(PKG_CONFIG) --libs libusb-1.0)
LDFLAGS += $(shell $(PKG_CONFIG) --libs libcurl)
CC ?= gcc
PKG_CONFIG ?= pkg-config
XZ = xz/xz_crc32.c xz/xz_crc64.c xz/xz_dec_bcj.c xz/xz_dec_lzma2.c xz/xz_dec_stream.c
SOURCES = em100.c firmware.c fpga.c hexdump.c sdram.c spi.c system.c trace.c usb.c
SOURCES += image.c curl.c chips.c tar.c $(XZ)
OBJECTS = $(SOURCES:.c=.o)
all: dep em100
em100: $(OBJECTS)
printf " LD em100\n"
$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
%: %.c
printf " CC+LD $@\n"
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $< $(LDFLAGS)
%.o: %.c
printf " CC $@\n"
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
dep: $(SOURCES)
$(CC) $(CFLAGS) -MM $(SOURCES) > .dependencies.tmp
sed -i 's,^xz,xz/xz,g' .dependencies.tmp
mv .dependencies.tmp .dependencies
tarballs: makedpfw makechips.sh
printf " CREATE config & firmware images\n"
LANG=C ./makechips.sh
clean:
rm -f em100 makedpfw
rm -f $(OBJECTS)
rm -rf configs{,.tar.xz} firmware{,.tar.xz}
rm -f .dependencies
distclean: clean
rm -f em100pro_chips.h
install: em100 60-dediprog-em100pro.rules
install -m 644 60-dediprog-em100pro.rules /etc/udev/rules.d/
install -s -m 750 -g plugdev em100 /usr/local/bin/
uninstall: /usr/local/bin/em100
rm -f /etc/udev/rules.d/60-dediprog-em100pro.rules
rm -f /usr/local/bin/em100
-include .dependencies
.PHONY: clean distclean tarballs