| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
.PHONY: check-env test all nsperl2 Ns clean |
|---|
| 4 |
|
|---|
| 5 |
define HELPTEXT |
|---|
| 6 |
echo "" &&\ |
|---|
| 7 |
echo "You need the following environment variables set correctly:" &&\ |
|---|
| 8 |
echo "" &&\ |
|---|
| 9 |
echo " NSPERL must point to your perl 5.10 installation perl *executable*" &&\ |
|---|
| 10 |
echo " NSINST must point to your aolserver installation *directory*" &&\ |
|---|
| 11 |
echo " TCLINST must point to your tcl 8.4 installation *directory*" &&\ |
|---|
| 12 |
echo " NSSRC must point to your aolserver source tree *directory*" &&\ |
|---|
| 13 |
echo "" &&\ |
|---|
| 14 |
echo "Also be careful of any existing CPATH CINCLUDES or LIBS environment variables" &&\ |
|---|
| 15 |
echo "see INSTALL.txt for other important information" &&\ |
|---|
| 16 |
echo "" |
|---|
| 17 |
endef |
|---|
| 18 |
|
|---|
| 19 |
export NSPERL2SRC = $(PWD) |
|---|
| 20 |
|
|---|
| 21 |
PERLMODULES = Ns Ns-Set Ns-Conn |
|---|
| 22 |
|
|---|
| 23 |
default: |
|---|
| 24 |
@$(HELPTEXT) |
|---|
| 25 |
|
|---|
| 26 |
# TODO: drive all the perl module related targets automatically from a single list |
|---|
| 27 |
|
|---|
| 28 |
install: check-env nsperl2 Ns.pm Ns-Set.pm Ns-Conn.pm Ns-TclApi.pm |
|---|
| 29 |
|
|---|
| 30 |
clean: check-env Ns/Makefile Ns-Set/Makefile Ns-Conn/Makefile Ns-TclApi/Makefile |
|---|
| 31 |
cd nsperl2 && $(MAKE) clean |
|---|
| 32 |
cd Ns && $(MAKE) clean |
|---|
| 33 |
cd Ns-Set && $(MAKE) clean |
|---|
| 34 |
cd Ns-Conn && $(MAKE) clean |
|---|
| 35 |
cd Ns-TclApi && $(MAKE) clean |
|---|
| 36 |
touch nsperl2.h |
|---|
| 37 |
|
|---|
| 38 |
test: check-env |
|---|
| 39 |
cd test && $(NSPERL) test_run.pl |
|---|
| 40 |
|
|---|
| 41 |
valgrind: |
|---|
| 42 |
cd test && $(NSPERL) test_run.pl --valgrind |
|---|
| 43 |
|
|---|
| 44 |
check-env: |
|---|
| 45 |
@test -n "$(NSPERL)" && test -x $(NSPERL) || (echo 'Error: bad NSPERL' && $(HELPTEXT) && false) |
|---|
| 46 |
@test -d $(NSINST) && test -x $(NSINST)/bin/nsd || (echo "Error: bad NSINST" && $(HELPTEXT) && false) |
|---|
| 47 |
@test -d $(TCLINST) && test -f $(TCLINST)/include/tcl.h || (echo "Error: bad TCLINST" && $(HELPTEXT) && false) |
|---|
| 48 |
@test -d $(NSSRC) && test -f $(NSSRC)/nsd/nsd.h || (echo "Error: bad NSSRC" && $(HELPTEXT) && false) |
|---|
| 49 |
@test -d $(NSPERL2SRC) && test -f $(NSPERL2SRC)/nsperl2/nsperl2.c || (echo "odd - NSPERL2SRC should get set up correctly by the Makefile: $(NSPERL2SRC)") |
|---|
| 50 |
@test -z "$(CPATH)" || echo "CPATH is set - are you sure you want this: $(CPATH)" |
|---|
| 51 |
@test -z "$(CINCLUDES)" || echo "CINCLUDES is set - are you sure you want this: $(CINCLUDES)" |
|---|
| 52 |
@test -z "$(LIBS)" || echo "LIBS is set - are you sure you want this: $(LIBS)" |
|---|
| 53 |
|
|---|
| 54 |
nsperl2: check-env $(NSINST)/bin/nsperl2.so |
|---|
| 55 |
|
|---|
| 56 |
$(NSINST)/bin/nsperl2.so: $(NSPERL2SRC)/nsperl2/*.c $(NSPERL2SRC)/*.h |
|---|
| 57 |
cd nsperl2 && $(MAKE) install |
|---|
| 58 |
touch $@ |
|---|
| 59 |
|
|---|
| 60 |
%/Makefile: %/Makefile.PL |
|---|
| 61 |
cd $* && $(NSPERL) Makefile.PL |
|---|
| 62 |
|
|---|
| 63 |
# too hard to get make to sensibly model the dependencies here |
|---|
| 64 |
# (eg. mulitple .pm files, shared typemap, etc). |
|---|
| 65 |
# make install is pretty quick, so we don't mind that the |
|---|
| 66 |
# check-env .PHONY rule will force this rule to always run |
|---|
| 67 |
%.pm: check-env nsperl2 %/Makefile |
|---|
| 68 |
cd $* && $(MAKE) install |
|---|
| 69 |
|
|---|
| 70 |
todo: |
|---|
| 71 |
find . ! -name '*~' |xargs grep -r TODO |
|---|