summaryrefslogtreecommitdiffstats
path: root/package/hdparm/hdparm.mk
blob: 343ae1dc358a6c8853ef479ce7d1401c95eb1317 (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
#############################################################
#
# hdparm
#
#############################################################
HDPARM_VERSION:=7.7
HDPARM_SOURCE:=hdparm-$(HDPARM_VERSION).tar.gz
HDPARM_SITE:=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/hdparm
HDPARM_CAT:=$(ZCAT)
HDPARM_DIR:=$(BUILD_DIR)/hdparm-$(HDPARM_VERSION)
HDPARM_BINARY:=hdparm
HDPARM_TARGET_BINARY:=sbin/hdparm

$(DL_DIR)/$(HDPARM_SOURCE):
	 $(WGET) -P $(DL_DIR) $(HDPARM_SITE)/$(HDPARM_SOURCE)

hdparm-source: $(DL_DIR)/$(HDPARM_SOURCE)

$(HDPARM_DIR)/.unpacked: $(DL_DIR)/$(HDPARM_SOURCE)
	$(HDPARM_CAT) $(DL_DIR)/$(HDPARM_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(HDPARM_DIR) package/hdparm \*.patch
	touch $@

$(HDPARM_DIR)/$(HDPARM_BINARY): $(HDPARM_DIR)/.unpacked
	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(HDPARM_DIR) \
		CFLAGS="$(TARGET_CFLAGS)" \
		LDFLAGS="$(TARGET_LDFLAGS)"

$(TARGET_DIR)/$(HDPARM_TARGET_BINARY): $(HDPARM_DIR)/$(HDPARM_BINARY)
	rm -f $(TARGET_DIR)/$(HDPARM_TARGET_BINARY)
	$(INSTALL) -D -m 0755 $(HDPARM_DIR)/$(HDPARM_BINARY) $(TARGET_DIR)/$(HDPARM_TARGET_BINARY)
ifeq ($(BR2_HAVE_MANPAGES),y)
	$(INSTALL) -D $(HDPARM_DIR)/hdparm.8 $(TARGET_DIR)/usr/share/man/man8/hdparm.8
endif
	$(STRIP) $(STRIP_STRIP_ALL) $@

hdparm: uclibc $(TARGET_DIR)/$(HDPARM_TARGET_BINARY)

hdparm-clean:
	-$(MAKE) -C $(HDPARM_DIR) clean
	rm -f $(TARGET_DIR)/$(HDPARM_TARGET_BINARY)

hdparm-dirclean:
	rm -rf $(HDPARM_DIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_HDPARM)),y)
TARGETS+=hdparm
endif