aboutsummaryrefslogtreecommitdiffstats
path: root/package/tftpd/tftpd.mk
blob: 927fab64f7058b1a64016973509acb1f1d793021 (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
77
78
79
80
81
#############################################################
#
# tftpd
#
#############################################################
TFTP_HPA_VERSION:=0.40
TFTP_HPA_SOURCE:=tftp-hpa-$(TFTP_HPA_VERSION).tar.bz2
TFTP_HPA_SITE:=$(BR2_KERNEL_MIRROR)/software/network/tftp/
TFTP_HPA_DIR:=$(BUILD_DIR)/tftp-hpa-$(TFTP_HPA_VERSION)
TFTP_HPA_CAT:=$(BZCAT)
TFTP_HPA_BINARY:=tftpd/tftpd
TFTP_HPA_TARGET_BINARY:=usr/sbin/in.tftpd

$(DL_DIR)/$(TFTP_HPA_SOURCE):
	 $(call DOWNLOAD,$(TFTP_HPA_SITE),$(TFTP_HPA_SOURCE))

tftpd-source: $(DL_DIR)/$(TFTP_HPA_SOURCE)

$(TFTP_HPA_DIR)/.unpacked: $(DL_DIR)/$(TFTP_HPA_SOURCE)
	$(TFTP_HPA_CAT) $(DL_DIR)/$(TFTP_HPA_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(TFTP_HPA_DIR) package/tftpd/ tftpd\*.patch
	touch $(TFTP_HPA_DIR)/.unpacked

$(TFTP_HPA_DIR)/.configured: $(TFTP_HPA_DIR)/.unpacked
	(cd $(TFTP_HPA_DIR); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/usr \
		--exec-prefix=/usr \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--libdir=/lib \
		--libexecdir=/usr/lib \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
		$(DISABLE_LARGEFILE) \
		--without-tcpwrappers \
	)
	touch $(TFTP_HPA_DIR)/.configured

$(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY): $(TFTP_HPA_DIR)/.configured
	$(MAKE) -C $(TFTP_HPA_DIR)

# This stuff is needed to work around GNU make deficiencies
$(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY): $(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY)
	@if [ -L $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY) ]; then \
		rm -f $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY); fi
	@if [ ! -f $(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY) -o $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY) \
	-ot $(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY) ]; then \
	    set -x; \
	    rm -f $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY); \
	    cp -a $(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY) $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY); fi
	@if [ ! -f $(TARGET_DIR)/etc/init.d/S80tftpd-hpa ]; then \
		$(INSTALL) -m 0755 package/tftpd/S80tftpd-hpa $(TARGET_DIR)/etc/init.d; \
	fi

tftpd: $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY)

tftpd-clean:
	rm -f $(TARGET_DIR)/etc/init.d/S80tftpd-hpa
	rm -f $(TARGET_DIR)/usr/sbin/in.tftpd
	-$(MAKE) -C $(TFTP_HPA_DIR) clean

tftpd-dirclean:
	rm -rf $(TFTP_HPA_DIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(BR2_PACKAGE_TFTPD),y)
TARGETS+=tftpd
endif