summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-06-01 14:25:23 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-06-01 14:25:23 +0000
commit828011aeaf136e67fb69ce16fb4265667ccda008 (patch)
tree7c8359e766cb52c6005196718be2edde1aea1936
parentad13d2293ae8b4353d8051abe63f063622ca623a (diff)
Makefile updates: Fix BSD make conditionals
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11397 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--.Makefile.inc30
-rwxr-xr-xconfigure63
2 files changed, 54 insertions, 39 deletions
diff --git a/.Makefile.inc b/.Makefile.inc
index 1b2010e33..0a51ad40d 100644
--- a/.Makefile.inc
+++ b/.Makefile.inc
@@ -6,22 +6,21 @@
# Please do not edit unless you know what you're doing.
#
-COMPILE_ROOT = $(shell pwd)
+@GNU_ONLY COMPILE_ROOT = $(shell pwd)
+@BSD_ONLY COMPILE_ROOT != pwd
-ifdef D
- ifeq ("$(origin D)", "command line")
+@IFDEF D
NICEFLAGS = @DEVELOPER@
HEADER = debug-header
- endif
-endif
+@ENDIF
-ifndef NICEFLAGS
+@IFNDEF NICEFLAGS
NICEFLAGS = @FLAGS@
-endif
+@ENDIF
-ifndef HEADER
+@IFNDEF HEADER
HEADER = std-header
-endif
+@ENDIF
NICEFLAGS += -I$(COMPILE_ROOT)/include
@@ -36,16 +35,17 @@ LAUNCHDPATH = "/System/Library/LaunchDaemons"
LIBPATH = "@LIBRARY_DIR@"
MODULES = @MODULES@
INSTMODE = 0755
-MAKEFLAGS += --no-print-directory
+@GNU_ONLY MAKEFLAGS += --no-print-directory
-ifdef V
+@IFDEF V
RUNCC = $(CC)
-else
- MAKEFLAGS += --silent
+@ELSE
+ @GNU_ONLY MAKEFLAGS += --silent
RUNCC = $(COMPILE_ROOT)/make/run-cc.pl $(CC)
-endif
+@ENDIF
-export COMPILE_ROOT RUNCC FLAGS NICEFLAGS CC LDLIBS MODULES MODPATH LIBPATH INSTMODE
+@GNU_ONLY export COMPILE_ROOT RUNCC FLAGS NICEFLAGS CC LDLIBS MODULES MODPATH LIBPATH INSTMODE
+@BSD_ONLY MAKEARGS = -s 'RUNCC=${RUNCC}' 'FLAGS=${FLAGS}' 'NICEFLAGS=${NICEFLAGS}' 'CC=${CC}' 'LDLIBS=${LDLIBS}' 'MODULES=${MODULES}' 'MODPATH=${MODPATH}' 'LIBPATH=${LIBPATH}' 'INSTMODE=${INSTMODE}'
all: ircd mods finishmessage
diff --git a/configure b/configure
index bf6ffb7c6..38d8027df 100755
--- a/configure
+++ b/configure
@@ -1288,34 +1288,49 @@ EOF
next if (($config{OSNAME} !~ /darwin/) && ($file eq "org.inspircd.plist"));
# All .name.inc files need parsing!
- $tmp = "";
open(FILEHANDLE, ".$file.inc") or die ("Can't open .$file.inc");
- while (<FILEHANDLE>) {
- $tmp .= $_;
- }
+ $_ = join '', <FILEHANDLE>;
close(FILEHANDLE);
print "Writing \e[1;32m$file\e[0m ...\n";
- $tmp =~ s/\@CC\@/$config{CC}/ if defined $config{CC};
- $tmp =~ s/\@FLAGS\@/$config{FLAGS}/ if defined $config{FLAGS};
- $tmp =~ s/\@DEVELOPER\@/$config{DEVELOPER}/ if defined $config{DEVELOPER};
- $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/ if defined $config{LDLIBS};
- $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/ if defined $config{BASE_DIR};
- $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/ if defined $config{CONFIG_DIR};
- $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/ if defined $config{MODULE_DIR};
- $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/ if defined $config{BINARY_DIR};
- $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/ if defined $config{LIBRARY_DIR};
- $tmp =~ s/\@MODULES\@/$modules/ if defined $modules;
- $tmp =~ s/\@STARTSCRIPT\@/$config{STARTSCRIPT}/ if defined $config{STARTSCRIPT};
- $tmp =~ s/\@DESTINATION\@/$config{DESTINATION}/ if defined $config{DESTINATION};
- $tmp =~ s/\@EXTRA_DIR\@/$config{EXTRA_DIR}/ if defined $config{EXTRA_DIR};
- $tmp =~ s/\@EXECUTABLE\@/$exe/ if defined $exe;
- $tmp =~ s/\@VERSION\@/$version/ if defined $version;
- $tmp =~ s/\@INSTALL_LIST\@/$install_list/ if defined $install_list;
- $tmp =~ s/\@UNINSTALL_LIST\@/$uninstall_list/ if defined $uninstall_list;
-
- open(FILEHANDLE, ">$file") or die("Can't write to $file: $!\n");
- print FILEHANDLE $tmp;
+ for my $var (qw(
+ CC FLAGS DEVELOPER LDLIBS BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR LIBRARY_DIR
+ STARTSCRIPT DESTINATION EXTRA_DIR
+ )) {
+ s/\@$var\@/$config{$var}/g;
+ }
+ s/\@MODULES\@/$modules/ if defined $modules;
+ s/\@EXECUTABLE\@/$exe/ if defined $exe;
+ s/\@VERSION\@/$version/ if defined $version;
+ s/\@INSTALL_LIST\@/$install_list/ if defined $install_list;
+ s/\@UNINSTALL_LIST\@/$uninstall_list/ if defined $uninstall_list;
+
+ if ($file eq 'Makefile') {
+ my $mk_tmp = $_;
+ s/\@IFDEF (\S+)/ifdef $1/g;
+ s/\@IFNDEF (\S+)/ifndef $1/g;
+ s/\@ELSE/else/g;
+ s/\@ENDIF/endif/g;
+ s/\@BSD_ONLY .*\n//g;
+ s/\@GNU_ONLY //g;
+ open MKF, '>GNUmakefile' or die "Can't write to GNUmakefile: $!";
+ print MKF $_;
+ close MKF;
+ $_ = $mk_tmp;
+ s/\@IFDEF (\S+)/.if defined($1)/g;
+ s/\@IFNDEF (\S+)/.if !defined($1)/g;
+ s/\@ELSE/.else/g;
+ s/\@ENDIF/.endif/g;
+ s/\@BSD_ONLY //g;
+ s/\@GNU_ONLY .*\n//g;
+ open MKF, '>BSDmakefile' or die "Can't write to BSDmakefile: $!";
+ print MKF $_;
+ close MKF;
+ } else {
+ open(FILEHANDLE, ">$file") or die("Can't write to $file: $!\n");
+ print FILEHANDLE $_;
+ close(FILEHANDLE);
+ }
}
}
closedir(DIRHANDLE);