summaryrefslogtreecommitdiffstats
path: root/rules/host-mtd.make
blob: e2fd1b118ef83082654baea18ddb610d13d3215f (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# -*-makefile-*-
# $Id$
#
# Copyright (C) 2003 by Pengutronix e.K., Hildesheim, Germany
#          
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
HOST_PACKAGES-$(PTXCONF_HOST_MTD) += host-mtd

#
# Paths and names
#
HOST_MTD		= $(MTD)
HOST_MTD_SOURCE	= $(MTD_SOURCE)
HOST_MTD_DIR	= $(HOST_BUILDDIR)/$(HOST_MTD)

-include $(call package_depfile)

# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

host-mtd_get: $(STATEDIR)/host-mtd.get

host-mtd_get_deps = $(STATEDIR)/mtd.get

$(STATEDIR)/host-mtd.get: $(host-mtd_get_deps)
	@$(call targetinfo, $@)
	@$(call get_patches, $(HOST_MTD))
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

host-mtd_extract: $(STATEDIR)/host-mtd.extract

host-mtd_extract_deps = $(STATEDIR)/host-mtd.get

$(STATEDIR)/host-mtd.extract: $(host-mtd_extract_deps)
	@$(call targetinfo, $@)
	@$(call clean, $(HOST_MTD_DIR))
	@$(call extract, $(HOST_MTD_SOURCE), $(HOST_BUILDDIR))
	@$(call patchin, $(HOST_MTD), $(HOST_MTD_DIR))
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

host-mtd_prepare: $(STATEDIR)/host-mtd.prepare

#
# dependencies
#
host-mtd_prepare_deps = \
	$(STATEDIR)/host-zlib.install \
	$(STATEDIR)/host-mtd.extract

HOST_MTD_MAKEVARS = \
	$(HOSTCC_ENV) \
	CFLAGS="-I$(PTXCONF_PREFIX)/include -I$(HOST_MTD_DIR)/include" \
	LDFLAGS=-L$(PTXCONF_PREFIX)/lib

$(STATEDIR)/host-mtd.prepare: $(host-mtd_prepare_deps)
	@$(call targetinfo, $@)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

host-mtd_compile: $(STATEDIR)/host-mtd.compile

host-mtd_compile_deps = $(STATEDIR)/host-mtd.prepare

$(STATEDIR)/host-mtd.compile: $(host-mtd_compile_deps)
	@$(call targetinfo, $@)
ifdef PTXCONF_HOST_MTD_MKJFFS
	cd $(HOST_MTD_DIR)/util && make mkfs.jffs $(HOST_MTD_MAKEVARS)
endif
ifdef PTXCONF_HOST_MTD_MKJFFS2
	cd $(HOST_MTD_DIR)/util && make mkfs.jffs2 $(HOST_MTD_MAKEVARS)
endif
ifdef PTXCONF_HOST_MTD_JFFS_DUMP
	cd $(HOST_MTD_DIR)/util && make jffs-dump $(HOST_MTD_MAKEVARS)
endif
ifdef PTXCONF_HOST_MTD_JFFS2_DUMP
	cd $(HOST_MTD_DIR)/util && make jffs2dump $(HOST_MTD_MAKEVARS)
endif
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

host-mtd_install: $(STATEDIR)/host-mtd.install

$(STATEDIR)/host-mtd.install: $(STATEDIR)/host-mtd.compile
	@$(call targetinfo, $@)
	mkdir -p $(PTXCONF_PREFIX)/bin

ifdef PTXCONF_HOST_MTD_MKJFFS
	install $(HOST_MTD_DIR)/util/mkfs.jffs $(PTXCONF_PREFIX)/bin
endif
ifdef PTXCONF_HOST_MTD_MKJFFS2
	install $(HOST_MTD_DIR)/util/mkfs.jffs2 $(PTXCONF_PREFIX)/bin
endif
ifdef PTXCONF_HOST_MTD_JFFS_DUMP
	install $(HOST_MTD_DIR)/util/jffs-dump $(PTXCONF_PREFIX)/bin
endif
ifdef PTXCONF_HOST_MTD_JFFS2_DUMP
	install $(HOST_MTD_DIR)/util/jffs2dump $(PTXCONF_PREFIX)/bin
endif
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

host-mtd_targetinstall: $(STATEDIR)/host-mtd.targetinstall

host-mtd_targetinstall_deps = $(STATEDIR)/host-mtd.install

$(STATEDIR)/host-mtd.targetinstall: $(host-mtd_targetinstall_deps)
	@$(call targetinfo, $@)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

host-mtd_clean:
	rm -rf $(STATEDIR)/host-mtd.*
	rm -rf $(HOST_MTD_DIR)

# vim: syntax=make