|
John Doing some tweaking and using OpenVPN because its a nicely behaved application here is a possible tutorial "makefile" Constructive comments are more than welcome, for example, variable naming here could be improved. I hope this is the approach your where looking for? This make file builds and the executables run #----------------------------------------------------------------- # The comments within this file are for those who, like myself # who are new at cross-compiling and creating a "makefile" for # for environments like Petalinux's userland and libland. # Thanks to the makefile experts out there from which most # of the information here was exploited. # # Currently this file is placed within the application directory # tree ./petalinux-dist/user/[application name]. (Possibly a # cleaner approach is to have the ./user/makefile create the # specific application directory??) This example is for building # the application "openvpn". First a clean # ./petalinux-dist/user/openvpn is created and this # "makefile" placed into it. Because DOWNLOADAPP is defined, a # new svn release of openvpn is pull into the directory. # #----------------------------------------------------------------- # Define ./configure options. Pay attention to ":=" and " \" as # these are required. CONFOPTS := --with-ssl-lib=$(ROOTDIR)/user/openssl \ --with-ssl-headers=$(ROOTDIR)/user/openssl/include #----------------------------------------------------------------- # Define CONFIGURE_OPTS here if the defaults need to be overridden. # For example, the defaults include the configure option # "--disable-shared" but this build of openvpn required the shared # library so CONFIGURE_OPTS is redefined without it. CONFIGURE_OPTS := --host=microblaze-linux \ --build=i686-pc-linux-gnu \ --target=microblaze-linux #------------------------------------------------------------------ # Define DOWNLOADAPP to retrieve the latest version of openvpn. # Since openvpn is well behaved an svn release pull can be # used. This is not always the case and may require manual # downloading of the application into the user/appl directory # directly. For example, applications which are closely integrated # with a particular linux kernel release. DOWNLOADAPP :=svn co \ http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn ./ #------------------------------------------------------------------ # Defines the distribution cleanup method. For example openvpn # uses a supplied script "doclean". Other applications might # use "make distclean". CLEANDIST := doclean #------------------------------------------------------------------ # Define the automake method. This could be autoconf, autoreconf # (as in the openvpn case) or automake. AUTOBUILD := autoreconf #------------------------------------------------------------------ # Define any automake options. AUTOBUILDOPTIONS := -i -v #------------------------------------------------------------------ # Define compiler options. This maybe required because the # application is not well behaved. # Openvpn does not require these definitions. #CC := mb-linux-gcc #CXX := mb-linux-g++ #RANLIB := mb-linux-ranlib #------------------------------------------------------------------ # Defines the application executable to be built into the romfs # APPNAME is used here so if more than one executable is used # they are listed here not within the non-editing portion of # this makefile. APPNAME := $(ROMFSINST) build/openvpn /bin/openvpn #------------------------------------------------------------------ # DO NOT EDITING ANYTHING BEYOND THIS POINT all: build/build $(MAKE) -C build build/build: makefile @rm -rf build @mkdir build ($(DOWNLOADAPP); \ ./$(CLEANDIST); \ $(AUTOBUILD) $(AUTOBUILDOPTIONS); \ cd build; \ sh ../configure $(CONFIGURE_OPTS) $(CONFOPTS)) @touch build/build clean: rm -rf build romfs: $(APPNAME) Insert movie times and more without leaving Hotmail®. See how. |