1 ######################################################
3 # An example makefile to fetch a package from sources
4 # then fetch the ipkg updates required to the base package
5 # extract the archives into the build tree
6 # and then build the source
8 ######################################################
11 # For this example we'll use a fairly simple package that compiles easily
12 # and has sources available for download at sourceforge
14 OIDENTD_TARGET
=oidentd
15 OIDENTD_DIR
=$(BUILD_DIR
)/oidentd-2.0
.7
16 OIDENTD_IPKTARGET
=oidentd-2.0
.7_mipsel.ipk
17 OIDENTD_SITE
=http
://easynews.dl.sourceforge.net
/sourceforge
/ojnk
18 OIDENTD_SOURCE
=oidentd-2.0
.7.
tar.gz
19 OIDENTDIPK_SITE
=http
://openwrt.rozeware.bc.ca
/ipkg-dev
20 OIDENTDIPK_SRC
=oidentd-2.0
.7-pkg.tgz
25 # define a target for the master makefile
26 oidentd
: $(OIDENTD_DIR
)/$(OIDENTD_TARGET
)
28 oidentd-ipk
: $(BUILD_DIR
)/$(OIDENTD_IPKTARGET
)
30 # We need to download sources if we dont have them
31 $(DL_DIR
)/$(OIDENTD_SOURCE
) :
32 $(WGET
) -P
$(DL_DIR
) $(OIDENTD_SITE
)/$(OIDENTD_SOURCE
)
34 # As well as the upstream package sources, we need the updates
36 $(DL_DIR
)/$(OIDENTDIPK_SRC
) :
37 $(WGET
) -P
$(DL_DIR
) $(OIDENTDIPK_SITE
)/$(OIDENTDIPK_SRC
)
39 # if we have the sources, they do no good unless they are unpacked
40 $(OIDENTD_DIR
)/.unpacked
: $(DL_DIR
)/$(OIDENTD_SOURCE
)
41 tar -C
$(BUILD_DIR
) -zxf
$(DL_DIR
)/$(OIDENTD_SOURCE
)
42 touch
$(OIDENTD_DIR
)/.unpacked
44 # if we have the sources unpacked, we need to configure them
45 $(OIDENTD_DIR
)/.configured
: $(OIDENTD_DIR
)/.unpacked
46 (cd
$(OIDENTD_DIR
); rm -rf config.cache
; \
47 $(TARGET_CONFIGURE_OPTS
) \
49 --target
=$(GNU_TARGET_NAME
) \
50 --host
=$(GNU_TARGET_NAME
) \
51 --build
=$(GNU_HOST_NAME
) \
57 touch
$(OIDENTD_DIR
)/.configured
60 # with the upstream sources unpacked, they still dont do much good without
61 # the ipkg control and rule files
62 $(OIDENTD_DIR
)/ipkg
/rules
: $(DL_DIR
)/$(OIDENTDIPK_SRC
) $(OIDENTD_DIR
)/.unpacked
63 tar -C
$(OIDENTD_DIR
) -zxf
$(DL_DIR
)/$(OIDENTDIPK_SRC
)
65 # now that we have it all in place, just build it
66 $(OIDENTD_DIR
)/$(OIDENTD_TARGET
): $(OIDENTD_DIR
)/.configured
67 cd
$(OIDENTD_DIR
); make
70 $(BUILD_DIR
)/$(OIDENTD_IPKTARGET
): $(OIDENTD_DIR
)/$(OIDENTD_TARGET
) $(OIDENTD_DIR
)/ipkg
/rules
71 (cd
$(OIDENTD_DIR
); $(IPKG_BUILDPACKAGE
))