forked from markh794/mhvtl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
99 lines (81 loc) · 2.4 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
#
# This makefile needs to be invoked as follows:
#
#make <options>
#
# Here, options include:
#
# all to build all utilities
# clean to clean up all intermediate files
# kernel to build kernel module
#
VER = $(shell awk '/Version/ {print $$2}' mhvtl-utils.spec)
REL = $(shell awk '/Release/ {print $$2}' mhvtl-utils.spec | sed s/%{?dist}//g)
VERSION ?= $(VER).$(REL)
EXTRAVERSION = $(if $(shell git show-ref 2>/dev/null),-git-$(shell git branch |awk '/\*/ {print $$2}'))
PARENTDIR = mhvtl-$(VER)
PREFIX ?= /usr
USR ?= vtl
SUSER ?=root
GROUP ?= vtl
MHVTL_HOME_PATH ?= /opt/mhvtl
MHVTL_CONFIG_PATH ?= /etc/mhvtl
LIBDIR ?= /usr/lib
CHECK_CC = cgcc
CHECK_CC_FLAGS = '$(CHECK_CC) -Wbitwise -Wno-return-void -no-compile $(ARCH)'
export PREFIX DESTDIR
CFLAGS=-Wall -g -O2 -D_LARGEFILE64_SOURCE $(RPM_OPT_FLAGS)
CLFLAGS=-shared
all: usr etc scripts
scripts: patch
$(MAKE) -C scripts MHVTL_HOME_PATH=$(MHVTL_HOME_PATH) MHVTL_CONFIG_PATH=$(MHVTL_CONFIG_PATH)
etc: patch
$(MAKE) -C etc USR=$(USR) GROUP=$(GROUP) MHVTL_HOME_PATH=$(MHVTL_HOME_PATH) MHVTL_CONFIG_PATH=$(MHVTL_CONFIG_PATH)
usr: patch
$(MAKE) -C usr USR=$(USR) GROUP=$(GROUP) MHVTL_HOME_PATH=$(MHVTL_HOME_PATH) MHVTL_CONFIG_PATH=$(MHVTL_CONFIG_PATH)
kernel: patch
$(MAKE) -C kernel
.PHONY:check
check: ARCH=$(shell sh scripts/checkarch.sh)
check:
CC=$(CHECK_CC_FLAGS) $(MAKE) all
tags:
$(MAKE) -C usr tags
$(MAKE) -C kernel tags
patch:
clean:
$(MAKE) -C usr clean
$(MAKE) -C etc clean
$(MAKE) -C scripts clean
$(MAKE) -C man clean
distclean:
$(MAKE) -C usr distclean
$(MAKE) -C etc distclean
$(MAKE) -C scripts distclean
$(MAKE) -C kernel distclean
$(MAKE) -C man clean
install:
$(MAKE) usr
$(MAKE) -C usr install $(LIBDIR) $(PREFIX) $(DESTDIR)
$(MAKE) scripts
$(MAKE) -C scripts install $(PREFIX) $(DESTDIR)
$(MAKE) etc
$(MAKE) -i -C etc install $(DESTDIR) USR=$(USR)
$(MAKE) -C man man
$(MAKE) -C man install $(PREFIX) $(DESTDIR) USR=$(USR)
test -d $(DESTDIR)/opt/mhvtl || mkdir -p $(DESTDIR)/opt/mhvtl
tar:
$(MAKE) distclean
test -d ../$(PARENTDIR) || ln -s mhvtl ../$(PARENTDIR)
(cd ..; tar cvfz /home/markh/mhvtl-`date +%F`-$(VERSION)$(EXTRAVERSION).tgz --exclude=.git \
$(PARENTDIR)/man \
$(PARENTDIR)/doc \
$(PARENTDIR)/kernel \
$(PARENTDIR)/usr \
$(PARENTDIR)/etc/ \
$(PARENTDIR)/scripts/ \
$(PARENTDIR)/include \
$(PARENTDIR)/Makefile \
$(PARENTDIR)/README \
$(PARENTDIR)/INSTALL \
$(PARENTDIR)/mhvtl-utils.spec)