summaryrefslogtreecommitdiff
path: root/demo-project
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-08-05 15:41:04 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-08-05 15:41:04 -0700
commitd7bb91cd264300351e94e37a84b1de45f2312745 (patch)
tree9464fd72647146c2642ab6b493f858afcfe51566 /demo-project
parent3a475005ce9f48b6bbf45a18660dbed6c4921269 (diff)
downloadattobuild-d7bb91cd264300351e94e37a84b1de45f2312745.tar.gz
attobuild-d7bb91cd264300351e94e37a84b1de45f2312745.tar.bz2
attobuild-d7bb91cd264300351e94e37a84b1de45f2312745.tar.xz
attobuild-d7bb91cd264300351e94e37a84b1de45f2312745.zip
Add a classy API, and use it to implement all the common options
Diffstat (limited to 'demo-project')
-rw-r--r--demo-project/Makefile.in9
-rwxr-xr-xdemo-project/configure54
-rw-r--r--demo-project/header.c16
-rw-r--r--demo-project/hello.c25
-rw-r--r--demo-project/hello.h22
-rw-r--r--demo-project/main.c24
6 files changed, 141 insertions, 9 deletions
diff --git a/demo-project/Makefile.in b/demo-project/Makefile.in
new file mode 100644
index 0000000..8f3f4f0
--- /dev/null
+++ b/demo-project/Makefile.in
@@ -0,0 +1,9 @@
+vpath %.c ${SRC_DIR}
+vpath %.h ${SRC_DIR}
+
+hello: main.o hello.o
+main.o: main.c hello.h
+hello.o: hello.c hello.h
+
+clean:
+ rm -f hello main.o hello.o
diff --git a/demo-project/configure b/demo-project/configure
index dc29870..a3e49ee 100755
--- a/demo-project/configure
+++ b/demo-project/configure
@@ -23,17 +23,53 @@ import os
import sys
from attoconf.version import require_version, string as version_string
-require_version(0, 1)
+require_version(0, 2)
-from attoconf.core import Project, Build
+from attoconf.classy import add_slots
+from attoconf.lib.c import C
+from attoconf.lib.install import Install
+from attoconf.lib.make import Make
-def main():
- print('Using', version_string)
- src = Project(os.path.dirname(sys.argv[0]))
- # customizations go here
+@add_slots
+class Configuration(C, Install, Make):
+ # usually you'll only have vars, features, and packages
+ # the rest should only be inherited
+ def __init__(self, srcdir):
+ super(Configuration, self).__init__(srcdir)
+
+ def general(self):
+ super(Configuration, self).general()
+
+ def paths(self):
+ super(Configuration, self).paths()
+
+ def arches(self):
+ super(Configuration, self).arches()
+
+ def vars(self):
+ super(Configuration, self).vars()
+
+ def features(self):
+ super(Configuration, self).features()
- # the rest shouldn't change
- build = Build(src, '.')
+ def packages(self):
+ super(Configuration, self).packages()
+
+ if 0:
+ def tests(self):
+ super(Configuration, self).tests()
+
+ def post(self):
+ super(Configuration, self).post()
+
+
+def main():
+ proj = Configuration(os.path.dirname(sys.argv[0]))
+ proj.set_package('attoconf-demo', version_string.split(' ')[1], 'Demo project for attoconf')
+ proj.jiggle()
+ build = proj.build('.')
build.configure(sys.argv[1:], os.environ)
-main()
+
+if __name__ == '__main__':
+ main()
diff --git a/demo-project/header.c b/demo-project/header.c
new file mode 100644
index 0000000..f231086
--- /dev/null
+++ b/demo-project/header.c
@@ -0,0 +1,16 @@
+// Copyright 2013 Ben Longbons <b.r.longbons@gmail.com>
+//
+// This file is part of attoconf.
+//
+// attoconf is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// attoconf is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with attoconf. If not, see <http://www.gnu.org/licenses/>.
diff --git a/demo-project/hello.c b/demo-project/hello.c
new file mode 100644
index 0000000..b018dc3
--- /dev/null
+++ b/demo-project/hello.c
@@ -0,0 +1,25 @@
+// Copyright 2013 Ben Longbons <b.r.longbons@gmail.com>
+//
+// This file is part of attoconf.
+//
+// attoconf is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// attoconf is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with attoconf. If not, see <http://www.gnu.org/licenses/>.
+
+#include "hello.h"
+
+#include <stdio.h>
+
+void hello(void)
+{
+ puts("Hello, World!");
+}
diff --git a/demo-project/hello.h b/demo-project/hello.h
new file mode 100644
index 0000000..899b9cc
--- /dev/null
+++ b/demo-project/hello.h
@@ -0,0 +1,22 @@
+#ifndef HELLO_H
+#define HELLO_H
+// Copyright 2013 Ben Longbons <b.r.longbons@gmail.com>
+//
+// This file is part of attoconf.
+//
+// attoconf is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// attoconf is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with attoconf. If not, see <http://www.gnu.org/licenses/>.
+
+void hello(void);
+
+#endif // HELLO_H
diff --git a/demo-project/main.c b/demo-project/main.c
new file mode 100644
index 0000000..2d363e2
--- /dev/null
+++ b/demo-project/main.c
@@ -0,0 +1,24 @@
+// Copyright 2013 Ben Longbons <b.r.longbons@gmail.com>
+//
+// This file is part of attoconf.
+//
+// attoconf is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// attoconf is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with attoconf. If not, see <http://www.gnu.org/licenses/>.
+
+#include "hello.h"
+
+int main()
+{
+ hello();
+ return 0;
+}