]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Write generated templates to the .configure directory.
authorPeter Powell <petpow@saberuk.com>
Tue, 22 Mar 2016 22:40:59 +0000 (22:40 +0000)
committerPeter Powell <petpow@saberuk.com>
Tue, 22 Mar 2016 23:38:44 +0000 (23:38 +0000)
.gitignore
make/configure.pm
make/template/main.mk

index 9400478be58d7473a6890b72163bcac10da46104..af4d891e041d271ddaa3dc4b773d83914b307213 100644 (file)
@@ -5,17 +5,12 @@
 .*
 !.git*
 
+/.configure
 /BSDmakefile
 /GNUmakefile
 /build
 /docs/doxygen
-/inspircd
-/inspircd.1
-/inspircd-genssl.1
-/inspircd.service
-/org.inspircd.plist
 /run
-/bin
 
 /include/config.h
 
index 06dd4de19f602444a7ea43a1742e87f268c5f23a..7614ca8842eb3442895d90295578de05e5241f85 100644 (file)
@@ -31,14 +31,16 @@ use feature ':5.10';
 use strict;
 use warnings FATAL => qw(all);
 
-use Cwd            qw(getcwd);
-use Exporter       qw(import);
-use File::Basename qw(basename);
+use Cwd                   qw(getcwd);
+use Exporter              qw(import);
+use File::Basename        qw(basename dirname);
+use File::Spec::Functions qw(catfile);
 
 use make::common;
 use make::console;
 use make::utilities;
 
+use constant CONFIGURE_DIRECTORY     => '.configure';
 use constant CONFIGURE_CACHE_FILE    => '.configure.cache';
 use constant CONFIGURE_CACHE_VERSION => '1';
 
@@ -87,6 +89,7 @@ sub __get_template_settings($$$) {
        }
 
        # Miscellaneous information
+       $settings{CONFIGURE_DIRECTORY} = CONFIGURE_DIRECTORY;
        $settings{CONFIGURE_CACHE_FILE} = CONFIGURE_CACHE_FILE;
        $settings{SYSTEM_NAME} = lc $^O;
        chomp($settings{SYSTEM_NAME_VERSION} = `uname -sr 2>/dev/null`);
@@ -337,7 +340,7 @@ sub parse_templates($$$) {
 
                        # Add a default target if the template has not defined one.
                        unless (scalar keys %targets) {
-                               $targets{DEFAULT} = basename $_;
+                               $targets{DEFAULT} = catfile(CONFIGURE_DIRECTORY, basename $_);
                        }
 
                        # Second pass: parse makefile junk and write files.
@@ -417,6 +420,13 @@ sub parse_templates($$$) {
                                        push @final_lines, $line;
                                }
 
+                               # Create the directory if it doesn't already exist.
+                               my $directory = dirname $target;
+                               unless (-e $directory) {
+                                       print_format "Creating <|GREEN $directory|> ...\n";
+                                       create_directory $directory, 0750 or print_error "unable to create $directory: $!";
+                               };
+
                                # Write the template file.
                                print_format "Writing <|GREEN $target|> ...\n";
                                open(TARGET, '>', $target) or print_error "unable to write $target: $!";
index cc201a12654c726207af7680e5d974de9df45604..7b153a924ba2c202d11283df1ce9f67e699ab223 100644 (file)
@@ -229,16 +229,16 @@ install: target
 @IFNDEF PURE_STATIC
        [ $(BUILDPATH)/modules/ -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) $(BUILDPATH)/modules/*.so $(MODPATH)
 @ENDIF
-       -$(INSTALL) -m $(INSTMODE_BIN) inspircd $(BASE) 2>/dev/null
+       -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(BASE) 2>/dev/null
        -$(INSTALL) -m $(INSTMODE_LIB) .gdbargs $(BASE)/.gdbargs 2>/dev/null
 @IFEQ $(SYSTEM) darwin
-       -$(INSTALL) -m $(INSTMODE_BIN) org.inspircd.plist $(BASE) 2>/dev/null
+       -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(BASE) 2>/dev/null
 @ENDIF
 @IFEQ $(SYSTEM) linux
-       -$(INSTALL) -m $(INSTMODE_LIB) inspircd.service $(BASE) 2>/dev/null
+       -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.service $(BASE) 2>/dev/null
 @ENDIF
-       -$(INSTALL) -m $(INSTMODE_LIB) inspircd.1 $(MANPATH) 2>/dev/null
-       -$(INSTALL) -m $(INSTMODE_LIB) inspircd-genssl.1 $(MANPATH) 2>/dev/null
+       -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null
+       -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd-genssl.1 $(MANPATH) 2>/dev/null
        -$(INSTALL) -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null
        -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples
        -$(INSTALL) -m $(INSTMODE_LIB) *.pem $(CONPATH) 2>/dev/null