From e281922d55e302bd823be89895006239248505e3 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 23 Oct 2007 16:42:03 +0000 Subject: Auto generate the install list, no more need to insert it into the .makefile.inc for it to be part of make install git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8312 e03df62e-2008-0410-955e-edbf42e46eb7 --- .Makefile.inc | 85 +++-------------------------------------------------------- configure | 29 ++++++++++---------- 2 files changed, 18 insertions(+), 96 deletions(-) diff --git a/.Makefile.inc b/.Makefile.inc index 367c77e22..398a2902e 100644 --- a/.Makefile.inc +++ b/.Makefile.inc @@ -18,7 +18,6 @@ MODPATH = $(DESTDIR)@MODULE_DIR@ BINPATH = $(DESTDIR)@BINARY_DIR@ LAUNCHDPATH = $(DESTDIR)/System/Library/LaunchDaemons LIBPATH = $(DESTDIR)@LIBRARY_DIR@ -LIB_EXT = @LIBRARY_EXT@ MODULES = @MODULES@ INSTMODE = 0755 MAKEARGS = 'PROGS=${PROGS}' 'FLAGS=${FLAGS}' 'CC=${CC}' 'LDLIBS=${LDLIBS}' 'MODULES=${MODULES}' 'MODPATH=${MODPATH}' 'LIBPATH=${LIBPATH}' 'INSTMODE=${INSTMODE}' @@ -67,91 +66,13 @@ ircd: ${MAKE} -C src DIRNAME="src" $(MAKEARGS) install: all@EXTRA_DIR@ - @-install -d -m $(INSTMODE) ${BASE} + @-install -d -m $(INSTMODE) $(BASE) @-install -d -m $(INSTMODE) $(LIBPATH) @-install -d -m $(INSTMODE) $(BINPATH) @-install -d -m $(INSTMODE) $(CONPATH) - @-install -d -m $(INSTMODE) ${MODPATH} - -install -m $(INSTMODE) src/libIRCDasyncdns.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDbase.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDchannels.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDcommand_parse.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDcommands.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDconfigreader.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDcull_list.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDdynamic.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDhash.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDhelper.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDinspsocket.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDmode.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDmodules.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDsocket.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDsocketengine.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDstring.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDuserprocess.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDusers.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDwildcard.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDxline.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDtimer.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDsnomasks.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDserver.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDfilelogger.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDuserresolver.$(LIB_EXT) $(LIBPATH) - -install -m $(INSTMODE) src/inspircd $(BINPATH) + @-install -d -m $(INSTMODE) $(MODPATH) +@INSTALL_LIST@ -install -m $(INSTMODE) src/inspircd $(BINPATH) -install -m $(INSTMODE) @STARTSCRIPT@ $(@DESTINATION@) 2>/dev/null - -install -m $(INSTMODE) src/commands/cmd_admin.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_away.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_clearcache.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_commands.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_connect.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_die.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_eline.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_gline.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_info.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_invite.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_ison.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_join.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_kick.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_kill.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_kline.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_links.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_list.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_loadmodule.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_lusers.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_map.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_modules.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_motd.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_names.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_nick.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_notice.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_oper.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_part.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_pass.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_ping.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_pong.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_privmsg.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_qline.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_quit.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_rehash.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_reloadmodule.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_restart.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_rules.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_server.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_squit.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_stats.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_time.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_topic.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_trace.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_unloadmodule.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_user.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_userhost.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_version.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_wallops.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_who.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_whois.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_whowas.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_zline.so $(LIBPATH) - -install -m $(INSTMODE) src/commands/cmd_mode.so $(LIBPATH) @-cp .gdbargs $(BASE) @-cp conf/inspircd.quotes.example $(CONPATH) @-cp conf/inspircd.rules.example $(CONPATH) diff --git a/configure b/configure index 1907e380c..001cf0dde 100755 --- a/configure +++ b/configure @@ -49,6 +49,10 @@ my @immutabledeps = ( # ############################################################################################### +# List of commands that make up 'make install' + +my $install_list = ""; + # This is a list of all files in the core. Each cpp file is mapped to a shared object file, # whos file extension is omitted (these can vary from system to system). Auto detected by # scanning the src/*.cpp files for files containing /* $Core: */ identifiers. @@ -1195,8 +1199,6 @@ EOF my $file = ""; my $exe = "inspircd"; - opendir(DIRHANDLE, $this); - # Do this once here, and cache it in the .*.inc files, # rather than attempting to read src/version.sh from # compiled code -- we might not have the source to hand. @@ -1206,14 +1208,15 @@ EOF chomp(my $revision = getrevision()); $version = "$version(r$revision)"; - my $LIBEXT = "so"; - if ($config{IS_DARWIN} eq "YES") - { - $LIBEXT = "dylib"; - } # We can actually parse any file starting with . and ending with .inc, # but right now we only parse .inspircd.inc to form './inspircd' + print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n"; + write_dynamic_makefile(); + write_dynamic_modules_makefile(); + + opendir(DIRHANDLE, $this); + foreach $name (sort readdir(DIRHANDLE)) { if ($name =~ /^\.(.+)\.inc$/) { $file = $1; @@ -1223,12 +1226,13 @@ EOF # All .name.inc files need parsing! $tmp = ""; - open(FILEHANDLE, ".$file.inc"); + open(FILEHANDLE, ".$file.inc") or die ("Can't open .$file.inc"); while () { $tmp .= $_; } close(FILEHANDLE); + print "Writing \033[1;32m$file\033[0m ...\n"; $tmp =~ s/\@CC\@/$config{CC}/; $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/; $tmp =~ s/\@FLAGS\@/$config{FLAGS}/; @@ -1239,7 +1243,6 @@ EOF $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/; $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/; $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/; - $tmp =~ s/\@LIBRARY_EXT\@/$LIBEXT/; $tmp =~ s/\@MODULES\@/$modules/; $tmp =~ s/\@STARTSCRIPT\@/$config{STARTSCRIPT}/; $tmp =~ s/\@DESTINATION\@/$config{DESTINATION}/; @@ -1247,8 +1250,8 @@ EOF $tmp =~ s/\@EXECUTABLE\@/$exe/; $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/; $tmp =~ s/\@VERSION\@/$version/; + $tmp =~ s/\@INSTALL_LIST\@/$install_list/; - print "Writing \033[1;32m$file\033[0m\n"; open(FILEHANDLE, ">$file"); print FILEHANDLE $tmp; } @@ -1257,10 +1260,6 @@ EOF # Make inspircd executable! chmod 0744, 'inspircd'; - - print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n"; - write_dynamic_makefile(); - write_dynamic_modules_makefile(); } sub write_dynamic_modules_makefile { @@ -1433,6 +1432,7 @@ sub write_dynamic_makefile if ($name =~ /^cmd_(.+)\.cpp$/) { $cmdlist[$i++] = $1; + $install_list = $install_list . " -install -m \$(INSTMODE) src/commands/cmd_" . $name . ".so \$(LIBPATH)\n"; } } closedir(DIRHANDLE); @@ -1519,6 +1519,7 @@ sub write_dynamic_makefile { $all = $all . $filelist{$cpp} . "." . $libraryext . " "; $all_libsonly = $all_libsonly . $filelist{$cpp} . "." . $libraryext . " "; + $install_list = $install_list . " -install -m \$(INSTMODE) src/" . $filelist{$cpp} . "." . $libraryext . " \$(LIBPATH)\n"; } $all = $all . "moo inspircd\n"; -- cgit v1.2.3