-
Notifications
You must be signed in to change notification settings - Fork 66
/
Makefile
112 lines (94 loc) · 2.5 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
#
# 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
#
include config.mk
PARENTDIR = mhvtl-$(VER)
CHECK_CC = cgcc
CHECK_CC_FLAGS = '$(CHECK_CC) -Wbitwise -Wno-return-void -no-compile $(ARCH)'
TAR_FILE := mhvtl-$(shell date +%F)-$(VERSION).$(EXTRAVERSION).tgz
MAKE_VTL_MEDIA = usr/make_vtl_media
export PREFIX DESTDIR TOPDIR
CFLAGS=-Wall -g -O2 -D_LARGEFILE64_SOURCE $(RPM_OPT_FLAGS)
CLFLAGS=-shared
all: usr etc scripts
scripts: patch
$(MAKE) -C scripts
etc: patch
$(MAKE) -C etc
usr: patch
$(MAKE) -C usr
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
$(MAKE) -C kernel clean
$(RM) -f mhvtl_kernel.tgz
.PHONY: distclean
distclean:
$(MAKE) -C usr distclean
$(MAKE) -C etc distclean
$(MAKE) -C scripts distclean
$(MAKE) -C kernel distclean
$(MAKE) -C man clean
$(RM) -f mhvtl_kernel.tgz
$(RM) ../$(TAR_FILE)
install: all
$(MAKE) -C usr install
$(MAKE) -C scripts install
$(MAKE) -i -C etc install
$(MAKE) -C man man
$(MAKE) -C man install
[ -d $(DESTDIR)$(MHVTL_HOME_PATH) ] || mkdir -p $(DESTDIR)$(MHVTL_HOME_PATH)
(cd kernel; tar --sort=name --mtime=@1 --format=gnu -czf ../mhvtl_kernel.tgz *)
[ -d $(DESTDIR)$(FIRMWAREDIR)/mhvtl ] || mkdir -p $(DESTDIR)$(FIRMWAREDIR)/mhvtl
install -m 755 mhvtl_kernel.tgz $(DESTDIR)$(FIRMWAREDIR)/mhvtl/
ifeq ($(ROOTUID),YES)
ldconfig
systemctl daemon-reload
endif
# now ensure VTL media is setup
env LD_LIBRARY_PATH=$(DESTDIR)$(LIBDIR) \
$(MAKE_VTL_MEDIA) \
--config-dir=$(DESTDIR)$(MHVTL_CONFIG_PATH) \
--home-dir=$(DESTDIR)$(MHVTL_HOME_PATH) \
--mktape-path=usr
tar: distclean
test -d ../$(PARENTDIR) || ln -s $(TOPDIR) ../$(PARENTDIR)
(cd kernel; tar cfz ../mhvtl_kernel.tgz *)
(cd ..; tar cvzf $(TAR_FILE) --exclude='.git*' \
$(PARENTDIR)/man \
$(PARENTDIR)/doc \
$(PARENTDIR)/kernel \
$(PARENTDIR)/usr \
$(PARENTDIR)/etc/ \
$(PARENTDIR)/scripts/ \
$(PARENTDIR)/ccan/ \
$(PARENTDIR)/tcopy/ \
$(PARENTDIR)/include \
$(PARENTDIR)/Makefile \
$(PARENTDIR)/config.mk \
$(PARENTDIR)/README \
$(PARENTDIR)/INSTALL \
$(PARENTDIR)/ChangeLog \
$(PARENTDIR)/mhvtl_kernel.tgz \
$(PARENTDIR)/mhvtl-utils.spec)
$(RM) ../$(PARENTDIR)