summaryrefslogtreecommitdiff
path: root/package/which/which.mk
blob: a87c14f4b7882568aee6c1b4ba5ebd0deea324c4 (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
#############################################################
#
# which
#
#############################################################
WHICH_VER:=2.16
WHICH_SOURCE:=which-$(WHICH_VER).tar.gz
WHICH_SITE:=http://www.xs4all.nl/~carlo17/which/
WHICH_DIR:=$(BUILD_DIR)/which-$(WHICH_VER)
WHICH_CAT:=$(ZCAT)
WHICH_BINARY:=which
WHICH_TARGET_BINARY:=bin/which

$(DL_DIR)/$(WHICH_SOURCE):
	$(WGET) -P $(DL_DIR) $(WHICH_SITE)/$(WHICH_SOURCE)

which-source: $(DL_DIR)/$(WHICH_SOURCE)

$(WHICH_DIR)/.unpacked: $(DL_DIR)/$(WHICH_SOURCE)
	$(WHICH_CAT) $(DL_DIR)/$(WHICH_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	touch $(WHICH_DIR)/.unpacked

$(WHICH_DIR)/.configured: $(WHICH_DIR)/.unpacked
	(cd $(WHICH_DIR); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS)" \
		LDFLAGS="$(TARGET_LDFLAGS)" \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/ \
	);
	touch $(WHICH_DIR)/.configured

$(WHICH_DIR)/$(WHICH_BINARY): $(WHICH_DIR)/.configured
	$(MAKE) CC=$(TARGET_CC) -C $(WHICH_DIR)

$(TARGET_DIR)/$(WHICH_TARGET_BINARY): $(WHICH_DIR)/$(WHICH_BINARY)
	install -D $(WHICH_DIR)/$(WHICH_BINARY) $(TARGET_DIR)/$(WHICH_TARGET_BINARY)

which: uclibc $(TARGET_DIR)/$(WHICH_TARGET_BINARY)

which-clean:
	rm -f $(TARGET_DIR)/$(WHICH_TARGET_BINARY)
	-$(MAKE) -C $(WHICH_DIR) clean

which-dirclean:
	rm -rf $(WHICH_DIR)
#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_WHICH)),y)
TARGETS+=which
endif