labyrinth

changeset 7:b557812c45db

generating the android (ant) project stuff from the makefile
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 04 May 2015 02:46:35 +0300
parents 345db647383a
children d3f1f74067b0
files android/AndroidManifest.xml android/Makefile android/build.xml android/manifest.xml.in proj.mk
diffstat 5 files changed, 36 insertions(+), 119 deletions(-) [+]
line diff
     1.1 --- a/android/AndroidManifest.xml	Sun May 03 02:23:54 2015 +0300
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,25 +0,0 @@
     1.4 -<?xml version="1.0" encoding="utf-8"?>
     1.5 -<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     1.6 -	package="com.mutantstargoat.labyrinth"
     1.7 -	android:versionCode="1"
     1.8 -	android:versionName="1.0">
     1.9 -
    1.10 -	<uses-sdk android:minSdkVersion="9"/>
    1.11 -
    1.12 -	<application android:label="labyrinth"
    1.13 -			android:hasCode="false"
    1.14 -			android:debuggable="true">
    1.15 -			<!-- android:icon="@drawable/ic_launcher" -->
    1.16 -
    1.17 -		<activity android:name="android.app.NativeActivity"
    1.18 -			android:label="Labyrinth">
    1.19 -
    1.20 -			<meta-data android:name="android.app.lib_name" android:value="labyrinth"/>
    1.21 -
    1.22 -			<intent-filter>
    1.23 -				<action android:name="android.intent.action.MAIN" />
    1.24 -				<category android:name="android.intent.category.LAUNCHER" />
    1.25 -			</intent-filter>
    1.26 -		</activity>
    1.27 -	</application>
    1.28 -</manifest>
     2.1 --- a/android/Makefile	Sun May 03 02:23:54 2015 +0300
     2.2 +++ b/android/Makefile	Mon May 04 02:46:35 2015 +0300
     2.3 @@ -50,9 +50,13 @@
     2.4  	@mkdir -p libs/armeabi
     2.5  	$(CC) -o $@ -shared $(obj) $(LDFLAGS)
     2.6  
     2.7 +ant_files = *.xml *.properties proguard-project.txt
     2.8 +ant_dirs = bin libs res
     2.9 +
    2.10  .PHONY: clean
    2.11  clean:
    2.12 -	rm -f $(obj) $(lib) $(apk-release) $(apk-debug)
    2.13 +	rm -f $(obj) $(lib) $(apk-release) $(apk-debug) $(ant_files)
    2.14 +	rm -rf $(ant_dirs)
    2.15  
    2.16  .PHONY: install
    2.17  install: install-debug
    2.18 @@ -77,6 +81,10 @@
    2.19  stop:
    2.20  	adb shell am force-stop $(pkg)
    2.21  
    2.22 +AndroidManifest.xml:
    2.23 +	android create project -p . -t $(android_platform) -k $(pkg) -a NativeActivity -n $(name)
    2.24 +	cat manifest.xml.in | sed 's/$$APPNAME/$(name)/g' | sed 's/$$APPTITLE/$(title)/g' >$@
    2.25 +
    2.26  .PHONY: update-project
    2.27  update-project: build.xml
    2.28 -	android update project --path . --target $(android_platform)
    2.29 +	android update project -p . -t $(android_platform)
     3.1 --- a/android/build.xml	Sun May 03 02:23:54 2015 +0300
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,92 +0,0 @@
     3.4 -<?xml version="1.0" encoding="UTF-8"?>
     3.5 -<project name="labyrinth" default="help">
     3.6 -
     3.7 -    <!-- The local.properties file is created and updated by the 'android' tool.
     3.8 -         It contains the path to the SDK. It should *NOT* be checked into
     3.9 -         Version Control Systems. -->
    3.10 -    <property file="local.properties" />
    3.11 -
    3.12 -    <!-- The ant.properties file can be created by you. It is only edited by the
    3.13 -         'android' tool to add properties to it.
    3.14 -         This is the place to change some Ant specific build properties.
    3.15 -         Here are some properties you may want to change/update:
    3.16 -
    3.17 -         source.dir
    3.18 -             The name of the source directory. Default is 'src'.
    3.19 -         out.dir
    3.20 -             The name of the output directory. Default is 'bin'.
    3.21 -
    3.22 -         For other overridable properties, look at the beginning of the rules
    3.23 -         files in the SDK, at tools/ant/build.xml
    3.24 -
    3.25 -         Properties related to the SDK location or the project target should
    3.26 -         be updated using the 'android' tool with the 'update' action.
    3.27 -
    3.28 -         This file is an integral part of the build system for your
    3.29 -         application and should be checked into Version Control Systems.
    3.30 -
    3.31 -         -->
    3.32 -    <property file="ant.properties" />
    3.33 -
    3.34 -    <!-- if sdk.dir was not set from one of the property file, then
    3.35 -         get it from the ANDROID_HOME env var.
    3.36 -         This must be done before we load project.properties since
    3.37 -         the proguard config can use sdk.dir -->
    3.38 -    <property environment="env" />
    3.39 -    <condition property="sdk.dir" value="${env.ANDROID_HOME}">
    3.40 -        <isset property="env.ANDROID_HOME" />
    3.41 -    </condition>
    3.42 -
    3.43 -    <!-- The project.properties file is created and updated by the 'android'
    3.44 -         tool, as well as ADT.
    3.45 -
    3.46 -         This contains project specific properties such as project target, and library
    3.47 -         dependencies. Lower level build properties are stored in ant.properties
    3.48 -         (or in .classpath for Eclipse projects).
    3.49 -
    3.50 -         This file is an integral part of the build system for your
    3.51 -         application and should be checked into Version Control Systems. -->
    3.52 -    <loadproperties srcFile="project.properties" />
    3.53 -
    3.54 -    <!-- quick check on sdk.dir -->
    3.55 -    <fail
    3.56 -            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
    3.57 -            unless="sdk.dir"
    3.58 -    />
    3.59 -
    3.60 -    <!--
    3.61 -        Import per project custom build rules if present at the root of the project.
    3.62 -        This is the place to put custom intermediary targets such as:
    3.63 -            -pre-build
    3.64 -            -pre-compile
    3.65 -            -post-compile (This is typically used for code obfuscation.
    3.66 -                           Compiled code location: ${out.classes.absolute.dir}
    3.67 -                           If this is not done in place, override ${out.dex.input.absolute.dir})
    3.68 -            -post-package
    3.69 -            -post-build
    3.70 -            -pre-clean
    3.71 -    -->
    3.72 -    <import file="custom_rules.xml" optional="true" />
    3.73 -
    3.74 -    <!-- Import the actual build file.
    3.75 -
    3.76 -         To customize existing targets, there are two options:
    3.77 -         - Customize only one target:
    3.78 -             - copy/paste the target into this file, *before* the
    3.79 -               <import> task.
    3.80 -             - customize it to your needs.
    3.81 -         - Customize the whole content of build.xml
    3.82 -             - copy/paste the content of the rules files (minus the top node)
    3.83 -               into this file, replacing the <import> task.
    3.84 -             - customize to your needs.
    3.85 -
    3.86 -         ***********************
    3.87 -         ****** IMPORTANT ******
    3.88 -         ***********************
    3.89 -         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
    3.90 -         in order to avoid having your file be overridden by tools such as "android update project"
    3.91 -    -->
    3.92 -    <!-- version-tag: 1 -->
    3.93 -    <import file="${sdk.dir}/tools/ant/build.xml" />
    3.94 -
    3.95 -</project>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/android/manifest.xml.in	Mon May 04 02:46:35 2015 +0300
     4.3 @@ -0,0 +1,25 @@
     4.4 +<?xml version="1.0" encoding="utf-8"?>
     4.5 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     4.6 +	package="com.mutantstargoat.$APPNAME"
     4.7 +	android:versionCode="1"
     4.8 +	android:versionName="1.0">
     4.9 +
    4.10 +	<uses-sdk android:minSdkVersion="9"/>
    4.11 +
    4.12 +	<application android:label="$APPNAME"
    4.13 +			android:hasCode="false"
    4.14 +			android:debuggable="true">
    4.15 +			<!-- android:icon="@drawable/ic_launcher" -->
    4.16 +
    4.17 +		<activity android:name="android.app.NativeActivity"
    4.18 +			android:label="$APPTITLE">
    4.19 +
    4.20 +			<meta-data android:name="android.app.lib_name" android:value="$APPNAME"/>
    4.21 +
    4.22 +			<intent-filter>
    4.23 +				<action android:name="android.intent.action.MAIN" />
    4.24 +				<category android:name="android.intent.category.LAUNCHER" />
    4.25 +			</intent-filter>
    4.26 +		</activity>
    4.27 +	</application>
    4.28 +</manifest>
     5.1 --- a/proj.mk	Sun May 03 02:23:54 2015 +0300
     5.2 +++ b/proj.mk	Mon May 04 02:46:35 2015 +0300
     5.3 @@ -2,6 +2,7 @@
     5.4  
     5.5  src = $(wildcard $(root)/src/*.c)
     5.6  bin = labyrinth
     5.7 +title = Labyrinth
     5.8  
     5.9  incpaths = -I$(root)/src
    5.10  libpaths =