forked from m0r1k/LinguaLeo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (43 loc) · 1.52 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
# vim: ts=4:expandtab
APP_NAME ?= lingualeo
APP_VERSION ?= 1.0.2
APP_RELEASE ?= 1
QMAKE ?= qmake-qt5
SRC_DIR ?= ./src/
SPEC_FILE ?= ./$(APP_NAME).spec
RPMS_DIR ?= ./rpms/
DESTDIR ?= ./dest/
TARGET ?= $(SRC_DIR)/$(APP_NAME)
VERSION_FILE ?= $(SRC_DIR)/version.h
.PHONY: default rpm clean install $(TARGET)
default: $(TARGET)
$(TARGET):
echo "#ifndef VERSION_HPP" > $(VERSION_FILE)
echo "#define VERSION_HPP" >> $(VERSION_FILE)
echo "#define APP_VERSION \"$(APP_VERSION)\"" >> $(VERSION_FILE)
echo "#define APP_RELEASE \"$(APP_RELEASE)\"" >> $(VERSION_FILE)
echo "#endif" >> $(VERSION_FILE)
cd $(SRC_DIR) && $(QMAKE)
$(MAKE) -C $(SRC_DIR)
clean:
$(MAKE) -C $(SRC_DIR) $@
rm -f $(SRC_DIR)/.qmake.stash
rm -f $(TARGET)
install:
## compile
$(MAKE)
## make dirs
mkdir -p $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)/usr/share/$(APP_NAME)/images/
mkdir -p $(DESTDIR)/usr/share/applications/
## copy files
cp -f $(TARGET) $(DESTDIR)/usr/bin/$(APP_NAME)
cp -f $(SRC_DIR)/images/* $(DESTDIR)/usr/share/$(APP_NAME)/images/
cp -f $(APP_NAME).desktop $(DESTDIR)/usr/share/applications/
rpm: clean
mkdir -p $(RPMS_DIR)
rpmbuild -bb $(SPEC_FILE) \
--define "package_path $(PWD)" \
--define "package_version $(APP_VERSION)" \
--define "package_release $(APP_RELEASE)" \
--define "_rpmdir $(RPMS_DIR)"