summaryrefslogtreecommitdiffstats
path: root/package/tinyhttpd/tinyhttpd.mk
blob: 0fd183a237da3f16f527e6c8ec3a063a31bf3cf4 (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
#############################################################
#
# tinyhttpd
#
#############################################################
TINYHTTPD_VER:=0.1.0
TINYHTTPD_SOURCE:=tinyhttpd-$(TINYHTTPD_VER).tar.gz
TINYHTTPD_SITE:=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/tinyhttpd/$(TINYHTTPD_SOURCE)
TINYHTTPD_DIR:=$(BUILD_DIR)/tinyhttpd-$(TINYHTTPD_VER)
TINYHTTPD_CAT:=$(ZCAT)
TINYHTTPD_BINARY:=httpd
TINYHTTPD_TARGET_BINARY:=usr/sbin/tinyhttpd

$(DL_DIR)/$(TINYHTTPD_SOURCE):
	 $(WGET) -P $(DL_DIR) $(TINYHTTPD_SITE)/$(TINYHTTPD_SOURCE)

tinyhttpd-source: $(DL_DIR)/$(TINYHTTPD_SOURCE)

#############################################################
#
# build tinyhttpd for use on the target system
#
#############################################################
$(TINYHTTPD_DIR)/.unpacked: $(DL_DIR)/$(TINYHTTPD_SOURCE)
	$(TINYHTTPD_CAT) $(DL_DIR)/$(TINYHTTPD_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	toolchain/patch-kernel.sh $(TINYHTTPD_DIR) package/tinyhttpd/ tinyhttpd\*.patch
	touch  $(TINYHTTPD_DIR)/.unpacked

$(TINYHTTPD_DIR)/$(TINYHTTPD_BINARY): $(TINYHTTPD_DIR)/.unpacked
	$(TARGET_CONFIGURE_OPTS) CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) -C $(TINYHTTPD_DIR)
    
$(TARGET_DIR)/$(TINYHTTPD_TARGET_BINARY): $(TINYHTTPD_DIR)/$(TINYHTTPD_BINARY)
	$(INSTALL) -m 0755 $(TINYHTTPD_DIR)/$(TINYHTTPD_BINARY) $(TARGET_DIR)/$(TINYHTTPD_TARGET_BINARY)
	$(STRIP) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/$(TINYHTTPD_TARGET_BINARY)
	$(INSTALL) -m 0755 package/tinyhttpd/S85tinyhttpd $(TARGET_DIR)/etc/init.d
	mkdir -p $(TARGET_DIR)/var/www

tinyhttpd: uclibc $(TARGET_DIR)/$(TINYHTTPD_TARGET_BINARY)

tinyhttpd-clean:
	$(MAKE) -C $(TINYHTTPD_DIR) clean
	@rm -f $(TARGET_DIR)/$(TINYHTTPD_TARGET_BINARY)
	@rm -f $(TARGET_DIR)/etc/init.d/S85tinyhttpd
	@rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/var/www

tinyhttpd-dirclean:
	rm -rf $(TINYHTTPD_DIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_TINYHTTPD)),y)
TARGETS+=tinyhttpd
endif