summaryrefslogtreecommitdiffstats
path: root/rules/xchain-mtd.make
blob: ba7730b9e178eaca45ce1258ec83e6044c1f216f (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
145
# -*-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
#
ifdef PTXCONF_MTD_XCHAIN
PACKAGES += xchain-mtd
endif

#
# Paths and names
#
XCHAIN_MTD		= $(MTD)
XCHAIN_MTD_SOURCE	= $(MTD_SOURCE)
XCHAIN_MTD_DIR		= $(XCHAIN_BUILDDIR)/$(XCHAIN_MTD)

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

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

xchain-mtd_get_deps = $(XCHAIN_MTD_SOURCE)

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

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

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

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

$(STATEDIR)/xchain-mtd.extract: $(xchain-mtd_extract_deps)
	@$(call targetinfo, $@)
	@$(call clean, $(XCHAIN_MTD_DIR))
	@$(call extract, $(XCHAIN_MTD_SOURCE), $(XCHAIN_BUILDDIR))
	@$(call patchin, $(XCHAIN_MTD), $(XCHAIN_MTD_DIR))
	touch $@

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

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

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

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

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

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

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

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

$(STATEDIR)/xchain-mtd.compile: $(xchain-mtd_compile_deps)
	@$(call targetinfo, $@)
ifdef PTXCONF_MTD_XCHAIN_MKJFFS
	cd $(XCHAIN_MTD_DIR)/util && make mkfs.jffs $(XCHAIN_MTD_MAKEVARS)
endif
ifdef PTXCONF_MTD_XCHAIN_MKJFFS2
	cd $(XCHAIN_MTD_DIR)/util && make mkfs.jffs2 $(XCHAIN_MTD_MAKEVARS)
endif
ifdef PTXCONF_MTD_XCHAIN_JFFS_DUMP
	cd $(XCHAIN_MTD_DIR)/util && make jffs_dump $(XCHAIN_MTD_MAKEVARS)
endif
ifdef PTXCONF_MTD_XCHAIN_JFFS2_DUMP
	cd $(XCHAIN_MTD_DIR)/util && make jffs2_dump $(XCHAIN_MTD_MAKEVARS)
endif

	touch $@

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

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

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

ifdef PTXCONF_MTD_XCHAIN_MKJFFS
	install $(XCHAIN_MTD_DIR)/util/mkfs.jffs $(PTXCONF_PREFIX)/bin
endif
ifdef PTXCONF_MTD_XCHAIN_MKJFFS2
	install $(XCHAIN_MTD_DIR)/util/mkfs.jffs2 $(PTXCONF_PREFIX)/bin
endif
ifdef PTXCONF_MTD_XCHAIN_JFFS_DUMP
	install $(XCHAIN_MTD_DIR)/util/jffs_dump $(PTXCONF_PREFIX)/bin
endif
ifdef PTXCONF_MTD_XCHAIN_JFFS2_DUMP
	install $(XCHAIN_MTD_DIR)/util/jffs2_dump $(PTXCONF_PREFIX)/bin
endif
	touch $@

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

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

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

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

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

xchain-mtd_clean:
	rm -rf $(STATEDIR)/xchain-mtd.*
	rm -rf $(XCHAIN_MTD_DIR)

# vim: syntax=make