Makefile 3.77 KB
Newer Older
Natanael Copa's avatar
Natanael Copa committed
1

Natanael Copa's avatar
Natanael Copa committed
2
VERSION		:= 3.5.0_rc1
Natanael Copa's avatar
Natanael Copa committed
3

Ain's avatar
Ain committed
4
sbindir		?= /sbin
5
6
7
sysconfdir	?= /etc/mkinitfs
datarootdir	?= /usr/share
datadir		?= $(datarootdir)/mkinitfs
Ain's avatar
Ain committed
8
mandir		?= $(datarootdir)/man
9

Natanael Copa's avatar
Natanael Copa committed
10
SBIN_FILES	:= mkinitfs bootchartd nlplug-findfs
11
SHARE_FILES	:= initramfs-init fstab passwd group
Natanael Copa's avatar
Natanael Copa committed
12
CONF_FILES	:= mkinitfs.conf \
13
14
15
16
		features.d/ata.modules \
		features.d/base.files \
		features.d/base.modules \
		features.d/bootchart.files \
17
		features.d/btrfs.files \
18
19
20
		features.d/btrfs.modules \
		features.d/cdrom.modules \
		features.d/cramfs.modules \
lemmarathon's avatar
lemmarathon committed
21
		features.d/cryptkey.files \
22
23
		features.d/cryptsetup.files \
		features.d/cryptsetup.modules \
24
		features.d/ena.modules \
25
26
27
28
29
30
31
32
33
34
35
		features.d/ext2.modules \
		features.d/ext3.modules \
		features.d/ext4.modules \
		features.d/f2fs.modules \
		features.d/floppy.modules \
		features.d/gfs2.modules \
		features.d/jfs.modules \
		features.d/keymap.files \
		features.d/kms.modules \
		features.d/lvm.files \
		features.d/lvm.modules \
Timo Teräs's avatar
Timo Teräs committed
36
		features.d/mmc.modules \
37
38
		features.d/nbd.files \
		features.d/nbd.modules \
39
40
		features.d/network.files \
		features.d/network.modules \
41
		features.d/nvme.modules \
42
		features.d/ocfs2.modules \
43
		features.d/raid.files \
44
45
		features.d/raid.modules \
		features.d/reiserfs.modules \
Henrik Riomar's avatar
Henrik Riomar committed
46
		features.d/rpirtc.modules \
47
48
49
50
51
		features.d/scsi.modules \
		features.d/squashfs.modules \
		features.d/ubifs.modules \
		features.d/usb.modules \
		features.d/virtio.modules \
Henrik Riomar's avatar
Henrik Riomar committed
52
		features.d/xenpci.modules \
Sascha Paunovic's avatar
Sascha Paunovic committed
53
		features.d/xfs.files \
Carlo Landmeter's avatar
Carlo Landmeter committed
54
		features.d/xfs.modules \
55
		features.d/zfs.files \
56
57
		features.d/zfs.modules \
		features.d/qeth.modules \
58
		features.d/dasd_mod.modules \
59
		features.d/zfcp.modules \
60
		features.d/dhcp.files \
61
		features.d/dhcp.modules \
62
		features.d/https.files
Ain's avatar
Ain committed
63
MAN_FILES       := mkinitfs.1 mkinitfs-bootparam.7 nlplug-findfs.1
Natanael Copa's avatar
Natanael Copa committed
64

Natanael Copa's avatar
Natanael Copa committed
65
SCRIPTS		:= mkinitfs bootchartd initramfs-init
Ain's avatar
Ain committed
66
IN_FILES	:= $(addsuffix .in,$(SCRIPTS) $(MAN_FILES))
67

68
GIT_REV := $(shell test -d .git && git describe || echo exported)
69
70
71
72
73
74
75
76
77
ifneq ($(GIT_REV), exported)
FULL_VERSION    := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
FULL_VERSION    := $(patsubst v%,%,$(FULL_VERSION))
else
FULL_VERSION    := $(VERSION)
endif


DISTFILES	:= $(IN_FILES) $(CONF_FILES) Makefile
Natanael Copa's avatar
Natanael Copa committed
78
79

INSTALL		:= install
80
SED		:= sed
81
82
83
SED_REPLACE	:= -e 's:@VERSION@:$(FULL_VERSION):g' \
		-e 's:@sysconfdir@:$(sysconfdir):g' \
		-e 's:@datadir@:$(datadir):g'
84

85
DEFAULT_FEATURES ?= ata base cdrom ext4 keymap kms mmc nvme raid scsi usb virtio
86
ifeq ($(shell uname -m), s390x)
87
DEFAULT_FEATURES += qeth dasd_mod zfcp
88
endif
Natanael Copa's avatar
Natanael Copa committed
89

Natanael Copa's avatar
Natanael Copa committed
90

Ain's avatar
Ain committed
91
all:	$(SBIN_FILES) $(SCRIPTS) $(CONF_FILES) $(MAN_FILES)
92
93

clean:
Ain's avatar
Ain committed
94
	rm -f $(SCRIPTS) $(MAN_FILES) mkinitfs.conf
95

Natanael Copa's avatar
Natanael Copa committed
96
help:
Natanael Copa's avatar
Natanael Copa committed
97
	@echo mkinitfs $(VERSION)
Natanael Copa's avatar
Natanael Copa committed
98
99
	@echo "usage: make install [DESTDIR=]"

Natanael Copa's avatar
Natanael Copa committed
100
101
102
103
104
105
106
107
CFLAGS ?= -Wall -Werror -g
CFLAGS += -D_GNU_SOURCE -DDEBUG

PKGCONF		?= pkg-config
BLKID_CFLAGS	:= $(shell $(PKGCONF) --cflags blkid)
BLKID_LIBS	:= $(shell $(PKGCONF) --libs blkid)
LIBKMOD_CFLAGS	:= $(shell $(PKGCONF) --cflags libkmod)
LIBKMOD_LIBS	:= $(shell $(PKGCONF) --libs libkmod)
108
109
CRYPTSETUP_CFLAGS := $(shell $(PKGCONF) --cflags libcryptsetup)
CRYPTSETUP_LIBS	:= $(shell $(PKGCONF) --libs libcryptsetup)
Natanael Copa's avatar
Natanael Copa committed
110

111
112
CFLAGS		+= $(BLKID_CFLAGS) $(LIBKMOD_CFLAGS) $(CRYPTSETUP_CFLAGS)
LIBS		= $(BLKID_LIBS) $(LIBKMOD_LIBS) $(CRYPTSETUP_LIBS)
Natanael Copa's avatar
Natanael Copa committed
113
114

%.o: %.c
Timo Teräs's avatar
Timo Teräs committed
115
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
Natanael Copa's avatar
Natanael Copa committed
116
117
118
119

nlplug-findfs: nlplug-findfs.o
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

120
121
122
123
124
.SUFFIXES:	.in
.in:
	${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@

install: $(SBIN_FILES) $(SHARE_FILES) $(CONF_FILES)
Natanael Copa's avatar
Natanael Copa committed
125
	for i in $(SBIN_FILES); do \
Ain's avatar
Ain committed
126
		$(INSTALL) -Dm755 $$i $(DESTDIR)/$(sbindir)/$$i;\
Natanael Copa's avatar
Natanael Copa committed
127
128
	done
	for i in $(CONF_FILES); do \
Ain's avatar
Ain committed
129
		$(INSTALL) -Dm644 $$i $(DESTDIR)/$(sysconfdir)/$$i;\
Natanael Copa's avatar
Natanael Copa committed
130
131
	done
	for i in $(SHARE_FILES); do \
Ain's avatar
Ain committed
132
		$(INSTALL) -D $$i $(DESTDIR)/$(datadir)/$$i;\
Natanael Copa's avatar
Natanael Copa committed
133
	done
Ain's avatar
Ain committed
134
135
136
	for i in $(MAN_FILES); do \
		$(INSTALL) -D $$i $(DESTDIR)$(mandir)/man$${i##*.}/$$i;\
	done
Natanael Copa's avatar
Natanael Copa committed
137

Natanael Copa's avatar
Natanael Copa committed
138
139
mkinitfs.conf:
	echo 'features="$(DEFAULT_FEATURES)"' > $@