Merged CMOP into Moose
[gitmo/Moose.git] / Makefile.PL
CommitLineData
38bf2a25 1use strict;
2use warnings;
3
4use Config;
5use ExtUtils::MakeMaker;
6
7warn <<'EOF';
8
9 ********************************* WARNING **********************************
10
11 This module uses Dist::Zilla for development. This Build.PL will let you run
12 the tests, but you are encouraged to install Dist::Zilla and the needed
13 plugins if you intend on doing any serious hacking.
14
15 ****************************************************************************
16
17EOF
18
19my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
20$ccflags .= ' -Wall -Wdeclaration-after-statement';
21
22my %mm = ( CCFLAGS => $ccflags );
23
24{
25 my (@OBJECT, %XS);
26
27 for my $xs (<xs/*.xs>) {
28 (my $c = $xs) =~ s/\.xs$/.c/i;
29 (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i;
30
31 $XS{$xs} = $c;
32 push @OBJECT, $o;
33 }
34
35 for my $c (<*.c>) {
36 (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i;
37 push @OBJECT, $o;
38 }
39
40 %mm = (
41 %mm,
42 clean => { FILES => join( q{ }, @OBJECT ) },
43 OBJECT => join( q{ }, @OBJECT ),
44 XS => \%XS,
45 );
46}
47
48WriteMakefile(
49 NAME => 'Moose',
50 %mm,
51);
52
53package MY;
54
55use Config;
56
57sub const_cccmd {
58 my $ret = shift->SUPER::const_cccmd(@_);
59 return q{} unless $ret;
60
61 if ($Config{cc} =~ /^cl\b/i) {
62 warn 'you are using MSVC... my condolences.';
63 $ret .= ' /Fo$@';
64 }
65 else {
66 $ret .= ' -o $@';
67 }
68
69 return $ret;
70}
71
72sub postamble {
73 return <<'EOF';
74$(OBJECT) : mop.h
75EOF
76}