-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
129 lines (96 loc) · 3.63 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# NOTE: This Makefile is not required to build the program, for which maven
# is used. Instead, it invokes the program for tests and for transforming the
# output, for example to the lirc.xml file.
MYDIR := $(dir $(firstword $(MAKEFILE_LIST)))
TOP := $(realpath $(MYDIR))
include $(MYDIR)/common/makefiles/paths.mk
INSTALLDIR := /usr/local/share/irptransmogrifier
BINLINK := /usr/local/bin/irptransmogrifier
BROWSELINK := /usr/local/bin/irpbrowse
PROJECT_NAME := IrpTransmogrifier
PROJECT_NAME_LOWERCASE := $(shell echo $(PROJECT_NAME) | tr A-Z a-z)
EXTRACT_VERSION := $(TOP)/common/xslt/extract_project_version.xsl
VERSION := $(shell $(XSLTPROC) $(EXTRACT_VERSION) pom.xml)
IRPHOME := $(TOP)/target
PROJECT_JAR := $(IRPHOME)/$(PROJECT_NAME)-$(VERSION)-jar-with-dependencies.jar
PROJECT_BIN := $(IRPHOME)/$(PROJECT_NAME)-$(VERSION)-bin.zip
IRPPROTOCOLS_XML := $(IRPHOME)/IrpProtocols.xml
#IRPTRANSMOGRIFIER := $(JAVA) -jar $(PROJECT_JAR) --loglevel warning --url-decode
UPLOADDIR_DIR := ftp://bengt-martensson.de/harctoolbox/
RMPROTOCOLS_URL := https://sourceforge.net/p/controlremote/code/HEAD/tree/trunk/km/src/main/config/rmProtocols.xml?format=raw
RMPROTOCOLS := $(IRPHOME)/rmProtocols.xml
IRPTRANSMOGRIFIER := $(JAVA) -jar $(PROJECT_JAR) -c $(IRPPROTOCOLS_XML)
MERGED := merged.xml
GH_PAGES := $(TOP)/gh-pages
ORIGINURL := $(shell git remote get-url origin)
CHKSUMS := md5 sha1 sha512
SUMS := $(foreach f,$(CHKSUMS),$(PROJECT_BIN).$f)
default: $(PROJECT_JAR)
$(PROJECT_JAR) $(PROJECT_BIN) $(SUMS):
mvn install -Dmaven.test.skip=true
$(PROJECT_JAR)-test:
mvn install -Dmaven.test.skip=false
release: push gh-pages tag deploy
version:
@echo $(VERSION)
setversion:
mvn versions:set -DnewVersion=$(NEWVERSION)
git commit -S -m "Set version to $(NEWVERSION)" pom.xml src/main/doc/$(PROJECT_NAME).releasenotes.txt
deploy:
mvn deploy -P release
@echo Possibly you need to update harctoolbox.org? At least IrpTransmogrifier.releasenotes.txt?
apidoc: target/site/apidocs
$(BROWSE) $</index.html
javadoc: target/site/apidocs
target/site/apidocs:
mvn javadoc:javadoc
push:
git push
gh-pages: target/site/apidocs
rm -rf $(GH_PAGES)
git clone --depth 1 -b gh-pages ${ORIGINURL} ${GH_PAGES}
( cd ${GH_PAGES} ; \
cp -rf ../target/site/apidocs/* . ; \
git add * ; \
git commit -S -a -m "Update of API documentation" ; \
git push )
$(INSTALLDIR):
mkdir -p $@
tag:
git checkout master
git status
git tag -s -a Version-$(VERSION) -m "Tagging Version-$(VERSION)"
git push origin Version-$(VERSION)
upload-harctoolbox:
@(cd $(TOP)/../www.harctoolbox.org ; \
make clean ; \
make site ; \
cd build/site/en ; \
for file in IrpTransmogrifier.html IrpTransmogrifier.pdf IrpTransmogrifier.releasenotes.txt wholesite.html wholesite.pdf ; do \
echo Uploading $$file... ; \
curl --netrc --upload-file $$file $(UPLOADDIR_DIR)/$$file;\
done )
# Only for Unix-like systems
install: $(PROJECT_BIN) | $(INSTALLDIR)
-rm -rf $(INSTALLDIR)/*
( cd $(INSTALLDIR); jar xf $< )
ln -sf $(INSTALLDIR)/$(PROJECT_NAME_LOWERCASE).sh $(BINLINK)
echo \#!/bin/sh > $(BROWSELINK)
echo $(BROWSE) $(INSTALLDIR)/IrpProtocols.html >> $(BROWSELINK)
chmod +x $(BROWSELINK) $(INSTALLDIR)/$(PROJECT_NAME_LOWERCASE).sh
uninstall:
rm -rf $(INSTALLDIR)
rm $(BINLINK)
clean:
mvn clean
rm -f all-protocols.xml lirc.xml pom.xml.versionsBackup
rm -rf $(GH_PAGES)
# Probably only for my own usage
merge: $(MERGED)
$(MERGED): $(RMPROTOCOLS) $(PROJECT_JAR)
$(IRPTRANSMOGRIFIER) -c $(RMPROTOCOLS) -o $@ --sort list --dump
$(RMPROTOCOLS):
curl --output $@ $(RMPROTOCOLS_URL)
all-protocols.xml: $(PROJECT_JAR)
$(IRPTRANSMOGRIFIER) --output $@ code --target xml
.PHONY: clean $(PROJECT_JAR)-test release