summaryrefslogtreecommitdiff
path: root/package/nbd/nbd.mk
blob: df8e1673162358fa88e86e1d09706984a7125b0c (plain)
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
#############################################################
#
# nbd (client only)
#
#############################################################

NBD_VERSION=2.9.11
NBD_SOURCE=nbd-$(NBD_VERSION).tar.bz2
NBD_CAT:=$(BZCAT)
NBD_SITE=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/nbd/
NBD_DIR=$(BUILD_DIR)/nbd-$(NBD_VERSION)

ifeq ($(BR2_NBD_CLIENT),y)
NBD_TARGET_BINARY+= $(TARGET_DIR)/sbin/nbd-client
endif
ifeq ($(BR2_NBD_SERVER),y)
NBD_TARGET_BINARY+= $(TARGET_DIR)/bin/nbd-server
endif

$(DL_DIR)/$(NBD_SOURCE):
	$(call DOWNLOAD,$(NBD_SITE),$(NBD_SOURCE))

$(NBD_DIR)/.unpacked: $(DL_DIR)/$(NBD_SOURCE)
	$(NBD_CAT) $(DL_DIR)/$(NBD_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	touch $@

$(NBD_DIR)/.patched: $(NBD_DIR)/.unpacked
	toolchain/patch-kernel.sh $(NBD_DIR) package/nbd/ nbd\*.patch
	touch $@

$(NBD_DIR)/.configured: $(NBD_DIR)/.patched
	(cd $(NBD_DIR); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		CC=$(TARGET_CC) \
		./configure $(QUIET) \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/usr \
		--sysconfdir=/etc \
	)
	touch $@

$(NBD_DIR)/nbd-client: $(NBD_DIR)/.configured
	$(MAKE) -C $(NBD_DIR) nbd-client

$(TARGET_DIR)/sbin/nbd-client: $(NBD_DIR)/nbd-client
	cp $< $@
	$(STRIPCMD) $@

$(NBD_DIR)/nbd-server: $(NBD_DIR)/.configured
	$(MAKE) -C $(NBD_DIR) nbd-server

$(TARGET_DIR)/bin/nbd-server: $(NBD_DIR)/nbd-server
	cp $< $@
	$(STRIPCMD) $@

nbd: libglib2 $(NBD_TARGET_BINARY)

nbd-source: $(DL_DIR)/$(NBD_SOURCE)

nbd-clean:
	rm -f $(NBD_TARGET_BINARY)
	-$(MAKE) -C $(NBD_DIR) clean

nbd-dirclean:
	rm -rf $(NBD_DIR)
#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(BR2_PACKAGE_NBD),y)
TARGETS+=nbd
endif