forked from neo-technologies/rkflashtool
-
Notifications
You must be signed in to change notification settings - Fork 68
/
Makefile
103 lines (88 loc) · 3.28 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Simple Makefile for RK Flash Tool
CC = $(CROSSPREFIX)gcc
LD = $(CC)
CFLAGS = -O2 -W -Wall
LDFLAGS =
PREFIX ?= usr/local
PKGCONFIG ?= $(shell pkg-config --exists libusb-1.0 && echo 1)
ifeq ($(PKGCONFIG),1)
CFLAGS += $(shell pkg-config --cflags libusb-1.0)
LDFLAGS += $(shell pkg-config --libs libusb-1.0)
else ifdef LIBUSB
CFLAGS += -I$(LIBUSB)/include
LDFLAGS += -L$(LIBUSB)/lib
else
CFLAGS += -I/usr/include/libusb-1.0
LDFLAGS += -lusb-1.0
endif
MACH = $(shell $(CC) -dumpmachine)
ifeq ($(findstring mingw,$(MACH)),mingw)
LDFLAGS += -s -static -lmman
USE_RES = 1
endif
ifeq ($(findstring cygwin,$(MACH)),cygwin)
LDFLAGS += -s
USE_RES = 1
endif
ifeq ($(USE_RES),1)
RC = $(CROSSPREFIX)windres
RCFLAGS = -O coff -i
BINEXT = .exe
RESFILE = %.res
AWK = awk
VERMAJ = $(shell $(AWK) '/define.*RKFLASHTOOL_VERSION_MAJOR/{print $$3}' version.h)
VERMIN = $(shell $(AWK) '/define.*RKFLASHTOOL_VERSION_MINOR/{print $$3}' version.h)
VERREV = 0
LCOPYR = 2010-2013 Ivo van Poorten, Fukaumi Naoki, Guenter Knauf, Ulrich Prinz, Steve Wilson
FDESCR = Flashtool for RK2808, RK2818, RK2918, RK3066, RK3068 and RK3188 based tablets
WWWURL = http://sourceforge.net/projects/rkflashtool/
ifeq ($(findstring /sh,$(SHELL)),/sh)
DL = '
endif
endif
PROGS = $(patsubst %.c,%$(BINEXT), $(wildcard *.c))
SCRIPTS = rkunsign rkparametersblock rkmisc rkpad rkparameters
all: $(PROGS) $(SCRIPTS)
%$(BINEXT): %.c $(RESFILE)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
install: $(PROGS) $(SCRIPTS)
install -d -m 0755 $(DESTDIR)/$(PREFIX)/bin
install -m 0755 $(PROGS) $(DESTDIR)/$(PREFIX)/bin
install -m 0755 $(SCRIPTS) $(DESTDIR)/$(PREFIX)/bin
clean:
$(RM) $(PROGS) *.res *.rc *.zip *.tar.gz *.tar.bz2 *.tar.xz *~ *.exe
uninstall:
cd $(DESTDIR)/$(PREFIX)/bin && $(RM) -f $(PROGS) $(SCRIPTS)
%.res: %.rc
$(RC) $(RCFLAGS) $< -o $@
%.rc: Makefile
@echo $(DL)1 VERSIONINFO $(DL)>$@
@echo $(DL) FILEVERSION $(VERMAJ),$(VERMIN),$(VERREV),0 $(DL)>>$@
@echo $(DL) PRODUCTVERSION $(VERMAJ),$(VERMIN),$(VERREV),0 $(DL)>>$@
@echo $(DL) FILEFLAGSMASK 0x3fL $(DL)>>$@
@echo $(DL) FILEOS 0x40004L $(DL)>>$@
@echo $(DL) FILEFLAGS 0x0L $(DL)>>$@
@echo $(DL) FILETYPE 0x1L $(DL)>>$@
@echo $(DL) FILESUBTYPE 0x0L $(DL)>>$@
@echo $(DL)BEGIN $(DL)>>$@
@echo $(DL) BLOCK "StringFileInfo" $(DL)>>$@
@echo $(DL) BEGIN $(DL)>>$@
@echo $(DL) BLOCK "040904E4" $(DL)>>$@
@echo $(DL) BEGIN $(DL)>>$@
@echo $(DL) VALUE "LegalCopyright","\251 $(LCOPYR)\\0" $(DL)>>$@
# @echo $(DL) VALUE "CompanyName","$(COMPANY)\\0" $(DL)>>$@
@echo $(DL) VALUE "ProductName","$(notdir $(@:.rc=)).exe\\0" $(DL)>>$@
@echo $(DL) VALUE "ProductVersion","$(VERMAJ).$(VERMIN).$(VERREV)\\0" $(DL)>>$@
@echo $(DL) VALUE "License","Released under BSD license.\\0" $(DL)>>$@
@echo $(DL) VALUE "FileDescription","$(FDESCR)\\0" $(DL)>>$@
@echo $(DL) VALUE "FileVersion","$(VERMAJ).$(VERMIN).$(VERREV)\\0" $(DL)>>$@
@echo $(DL) VALUE "InternalName","$(notdir $(@:.rc=))\\0" $(DL)>>$@
@echo $(DL) VALUE "OriginalFilename","$(notdir $(@:.rc=)).exe\\0" $(DL)>>$@
@echo $(DL) VALUE "WWW","$(WWWURL)\\0" $(DL)>>$@
@echo $(DL) END $(DL)>>$@
@echo $(DL) END $(DL)>>$@
@echo $(DL) BLOCK "VarFileInfo" $(DL)>>$@
@echo $(DL) BEGIN $(DL)>>$@
@echo $(DL) VALUE "Translation", 0x409, 1252 $(DL)>>$@
@echo $(DL) END $(DL)>>$@
@echo $(DL)END $(DL)>>$@