From c27fd87803761d4e6829e931612bfb6928c23d73 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Thu, 26 Aug 2010 12:17:29 +0000 Subject: * utils/Makefile.in: Install libOpenAxiom.a * driver/main.c (print_configuration_info): New. (main): Handle --config. * driver/utils.c (openaxiom_build_rts_options): Likewise. * driver/utils.h (openaxiom_config_driver): New driver enumerator. --- src/ChangeLog | 8 ++++++++ src/driver/Makefile.in | 2 +- src/driver/main.c | 25 ++++++++++++++++++++++++- src/driver/utils.c | 3 +++ src/driver/utils.h | 1 + src/utils/Makefile.in | 8 +++++++- 6 files changed, 44 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 03f24094..90543b37 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-08-26 Gabriel Dos Reis + + * utils/Makefile.in: Install libOpenAxiom.a + * driver/main.c (print_configuration_info): New. + (main): Handle --config. + * driver/utils.c (openaxiom_build_rts_options): Likewise. + * driver/utils.h (openaxiom_config_driver): New driver enumerator. + 2010-08-26 Gabriel Dos Reis * utils/Makefile.in: Install headers. diff --git a/src/driver/Makefile.in b/src/driver/Makefile.in index 934a16e9..52ead916 100644 --- a/src/driver/Makefile.in +++ b/src/driver/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2009, Gabriel Dos Reis. +# Copyright (C) 2007-2010, Gabriel Dos Reis. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/src/driver/main.c b/src/driver/main.c index c1af3879..f5083ff5 100644 --- a/src/driver/main.c +++ b/src/driver/main.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2009, Gabriel Dos Reis. + Copyright (C) 2008-2010, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -85,6 +85,25 @@ upgrade_environment(const char* sysdir) { publish_systemdir(sysdir); } +/* Print configuration info. */ +static int +print_configuration_info(openaxiom_command* command) { + int i; + for (i = 1; i < command->core.argc; ++i) { + if (strcmp(command->core.argv[i], "include") == 0) + printf(" -I\"%s\"/include", command->root_dir); + else if (strcmp(command->core.argv[i], "lib") == 0) + printf(" -L\"%s\"/lib -lOpenAxiom", command->root_dir); + else { + fprintf(stderr, "open-axiom: invalid request %s\n", + command->core.argv[i]); + return 1; + } + } + fflush(stdout); + return 0; +} + int main(int argc, char* argv[]) @@ -97,6 +116,10 @@ main(int argc, char* argv[]) switch (driver) { case openaxiom_null_driver: return 0; /* Bye. */ + + case openaxiom_config_driver: + return print_configuration_info(&command); + case openaxiom_core_driver: case openaxiom_script_driver: case openaxiom_compiler_driver: diff --git a/src/driver/utils.c b/src/driver/utils.c index 0936705f..ed85339d 100644 --- a/src/driver/utils.c +++ b/src/driver/utils.c @@ -120,6 +120,7 @@ openaxiom_build_rts_options(openaxiom_command* command, openaxiom_driver driver) { switch (driver) { + case openaxiom_config_driver: case openaxiom_sman_driver: case openaxiom_execute_driver: case openaxiom_unknown_driver: @@ -232,6 +233,8 @@ openaxiom_preprocess_arguments(openaxiom_command* command, driver = openaxiom_core_driver; else if (strcmp(argv[i], "--server") == 0) driver = openaxiom_sman_driver; + else if (strcmp(argv[i], "--config") == 0) + driver = openaxiom_config_driver; else if (strcmp(argv[i], "--execute") == 0) { driver = openaxiom_execute_driver; break; diff --git a/src/driver/utils.h b/src/driver/utils.h index eebb1783..b47970da 100644 --- a/src/driver/utils.h +++ b/src/driver/utils.h @@ -50,6 +50,7 @@ extern "C" { typedef enum openaxiom_driver { openaxiom_unknown_driver, /* unknown driver */ openaxiom_null_driver, /* do nothing */ + openaxiom_config_driver, /* print out configuration information */ openaxiom_sman_driver, /* start Superman as master process */ openaxiom_core_driver, /* start the core system as master process */ openaxiom_script_driver, /* start the core system in script mode. */ diff --git a/src/utils/Makefile.in b/src/utils/Makefile.in index 4f43e115..db30091e 100644 --- a/src/utils/Makefile.in +++ b/src/utils/Makefile.in @@ -47,6 +47,8 @@ oa_target_headerdir = $(oa_target_includedir)/open-axiom oa_include_flags = -I. -I$(oa_target_includedir) -I$(top_builddir)/config +oa_target_oalib = $(axiom_target_libdir)/libOpenAxiom.$(LIBEXT) + .PHONY: all all-ax all-utils .SUFFIXES: .SUFFIXES: .cc .H .$(OBJEXT) .$(LIBEXT) @@ -57,10 +59,13 @@ all: all-ax all-ax all-utils: stamp -stamp: libOpenAxiom.$(LIBEXT) hammer$(EXEEXT) +stamp: $(oa_target_oalib) hammer$(EXEEXT) -rm -f stamp $(STAMP) stamp +$(oa_target_oalib): libOpenAxiom.$(LIBEXT) + cp $< $@ + stamp-headers: $(libOpenAxiom_HEADERS) Makefile rm -f stamp-headers if [ ! -d $(oa_target_headerdir) ]; then \ @@ -92,6 +97,7 @@ libOpenAxiom.$(LIBEXT): $(libOpenAxiom_OBJECTS) mostlyclean-local: @rm -rf .libs @rm -rf $(oa_include_headerdir) stamp-headers + @rm -f $(oa_target_oalib) @rm -f $(libOpenAxiom_OBJECTS) @rm -f *~ core -- cgit v1.2.3