| 1 | use 5.006; |
|---|
| 2 | use strict; |
|---|
| 3 | use warnings; |
|---|
| 4 | use ExtUtils::MakeMaker; |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | my $includes = '/usr/include'; |
|---|
| 8 | my @define; |
|---|
| 9 | my @c = ('parse_keyword.c', 'compute_crc32.c', <*.c>); |
|---|
| 10 | my %exclude; |
|---|
| 11 | if ($^O eq 'MSWin32') { |
|---|
| 12 | ++$exclude{'socket_posix.c'}; |
|---|
| 13 | } else { |
|---|
| 14 | ++$exclude{'socket_win32.c'}; |
|---|
| 15 | ++$exclude{'addrinfo_hostent.c'}; |
|---|
| 16 | |
|---|
| 17 | if (-f "$includes/poll.h") { |
|---|
| 18 | push @define, '-DHAVE_POLL_H'; |
|---|
| 19 | ++$exclude{'poll_select.c'}; |
|---|
| 20 | } elsif (-f "$includes/sys/poll.h") { |
|---|
| 21 | push @define, '-DHAVE_SYS_POLL_H'; |
|---|
| 22 | ++$exclude{'poll_select.c'}; |
|---|
| 23 | } |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | my @object = grep { not exists $exclude{$_} } @c; |
|---|
| 27 | map { s/\.c$/\$(OBJ_EXT)/ } @object; |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | # See lib/ExtUtils/MakeMaker.pm for details of how to influence |
|---|
| 31 | # the contents of the Makefile that is written. |
|---|
| 32 | WriteMakefile( |
|---|
| 33 | NAME => 'Cache::Memcached::Fast::libclient', |
|---|
| 34 | VERSION_FROM => '../lib/Cache/Memcached/Fast.pm', |
|---|
| 35 | AUTHOR => 'Tomash Brechko <tomash.brechko@gmail.com>', |
|---|
| 36 | LIBS => [''], # e.g., '-lm' |
|---|
| 37 | DEFINE => "@define", # e.g., '-DHAVE_SOMETHING' |
|---|
| 38 | INC => '-I.', # e.g., '-I. -I/usr/include/other' |
|---|
| 39 | OBJECT => "@object", |
|---|
| 40 | # The following line prevents installation of libclient.a. |
|---|
| 41 | SKIP => [qw(all static static_lib dynamic dynamic_lib)], |
|---|
| 42 | clean => { FILES => 'compute_crc32.c compute_crc32.h' |
|---|
| 43 | . ' parse_keyword.c parse_keyword.h' }, |
|---|
| 44 | ); |
|---|
| 45 | |
|---|
| 46 | sub MY::top_targets { |
|---|
| 47 | ' |
|---|
| 48 | all :: static |
|---|
| 49 | |
|---|
| 50 | pure_all :: static |
|---|
| 51 | |
|---|
| 52 | static :: libclient$(LIB_EXT) |
|---|
| 53 | |
|---|
| 54 | libclient$(LIB_EXT): $(OBJECT) |
|---|
| 55 | $(AR) cr libclient$(LIB_EXT) $(OBJECT) |
|---|
| 56 | $(RANLIB) libclient$(LIB_EXT) |
|---|
| 57 | |
|---|
| 58 | parse_keyword.c parse_keyword.h :: genparser.pl reply.kw |
|---|
| 59 | $(PERL) genparser.pl reply.kw parse_keyword.c parse_keyword.h |
|---|
| 60 | |
|---|
| 61 | compute_crc32.c compute_crc32.h :: gencrc32.pl |
|---|
| 62 | $(PERL) gencrc32.pl compute_crc32.c compute_crc32.h |
|---|
| 63 | ' |
|---|
| 64 | } |
|---|