Index: /trunk/Ohana/Configure
===================================================================
--- /trunk/Ohana/Configure	(revision 2509)
+++ /trunk/Ohana/Configure	(revision 2510)
@@ -3,7 +3,7 @@
 # this is the location of the package
 # change this to match your location of the source
-# ROOT    = /h/eugene/src/ohana
-ROOT    = /home/eugene/src/test/ohana
-#
+ROOT    = /data/elixir/srcdir/ohana
+# ARCH    = ARCHVAL
+
 # destination directories:
 # these are the installation directories.
@@ -11,18 +11,14 @@
 # need to copy the include files in $(ROOT)/include by hand to the destination
 LBIN	= $(ROOT)/bin/$(ARCH)
-LINC	= $(ROOT)/include
+LINC	= $(ROOT)/include/$(ARCH)
 LLIB	= $(ROOT)/lib/$(ARCH)
 LMAN	= $(ROOT)/man/man1
-#
+
 # X include and lib directories
 # put your X paths here if they are not automatically included (they
 # seem to be ok on most linux distributions)
-XINC    = /usr/openwin/include 
-XLIB    = -L/usr/openwin/lib -L/usr/X11R6/lib
-# 
+XINC    = /usr/include
+XLIB    = -L/usr/X11R6/lib
+
 # prefered C compiler
-CC   = gcc -g -Wall -Werror
-#CC   = gcc -g
-
-# EXPORT = $(shell gettargets)
-EXPORT = manao:/apps/elixir/bin lawelawe:/apps/elixir/bin
+CC   = gcc -g -O
Index: /trunk/Ohana/Configure.in
===================================================================
--- /trunk/Ohana/Configure.in	(revision 2510)
+++ /trunk/Ohana/Configure.in	(revision 2510)
@@ -0,0 +1,24 @@
+# Configure file for Ohana Package
+#
+# this is the location of the package
+# change this to match your location of the source
+ROOT    = ROOTDIR
+ARCH    = ARCHVAL
+
+# destination directories:
+# these are the installation directories.
+# if you use a different toplevel directory than $(ROOT), you might 
+# need to copy the include files in $(ROOT)/include by hand to the destination
+LBIN	= $(ROOT)/bin/$(ARCH)
+LINC	= $(ROOT)/include/$(ARCH)
+LLIB	= $(ROOT)/lib/$(ARCH)
+LMAN	= $(ROOT)/man/man1
+
+# X include and lib directories
+# put your X paths here if they are not automatically included (they
+# seem to be ok on most linux distributions)
+XINC    = XINCDIR
+XLIB    = -LXLIBDIR
+
+# prefered C compiler
+CC   = gcc -g -O
Index: /trunk/Ohana/Makefile
===================================================================
--- /trunk/Ohana/Makefile	(revision 2509)
+++ /trunk/Ohana/Makefile	(revision 2510)
@@ -17,38 +17,35 @@
 # readline.  Extra care should be taken in compiling those libraries. 
 
+# Edit Configure to reflect the location of your installation (or use ./configure)
+include Configure
+
 # .SILENT:								       
 default: all
 
-# Edit Configure to reflect the location of your installation
-include Configure
-
-# ARCH is used to isolate binaries from different architectures
-# warning: this is a gnu-make specific syntax
-ARCH = $(shell getarch)
-
 # The collection of Ohana programs.  Other components in the src
 # directory may be compiled by going to those directories. 
-PROGRAM = \
-addrefs    \
-addspphot  \
-addstar    \
-delstar    \
-elixir     \
-gastro     \
-gastro2    \
-gcompare   \
-gophot     \
-imclean    \
-imregister \
-kapa       \
-kii        \
-misc       \
+PROGRAM =   \
+addrefs     \
+addspphot   \
+addstar     \
+delstar     \
+elixir      \
+gastro      \
+gastro2     \
+gcompare    \
+gophot      \
+imclean     \
+imregister  \
+kapa        \
+kii         \
+misc        \
 mosastro.v2 \
-nightd     \
-perl       \
-photdbc    \
-relphot    \
-shell      \
-tcl        \
+nightd      \
+opihi.v2    \
+perl        \
+photdbc     \
+relphot     \
+shell       \
+tcl         \
 uniphot
 
@@ -63,10 +60,11 @@
 
 # Required libraries depends on the architecture
-LIBS-linux = libohana libfits libdummy
-LIBS-lin64 = libohana libfits libdummy
+LIBS-linux = libfits libohana libdummy
+LIBS-lin64 = libfits libohana libdummy
 
 # general build targets:
 libs:
-	mkdir -p lib/$(ARCH)
+	mkdir -p $(LINC)
+	mkdir -p $(LLIB)
 	for i in $(LIBS-$(ARCH)); do make $$i.install; done
 
Index: /trunk/Ohana/configure
===================================================================
--- /trunk/Ohana/configure	(revision 2510)
+++ /trunk/Ohana/configure	(revision 2510)
@@ -0,0 +1,171 @@
+#!/bin/csh -f
+
+# this is a very low-tech version of configure, not built by autoconf.
+# we check for the following libraries:
+
+# libX11.a
+# libsocket.a
+# libnsl.a
+# libpng.a
+# libjpeg.a
+# libreadline.a
+# libtermcap.a
+
+# evaluate command-line options
+set vararch = 0
+set root = ""
+set args = ""
+while ("$1" != "") 
+ switch ($1)
+  case --prefix
+   shift
+   set root = $1
+   breaksw;
+  case --vararch
+   set vararch = 1
+   breaksw;
+  case -*: 
+   goto usage
+   breaksw;
+  default:
+   set args=($args $1);
+   breaksw;
+ endsw
+ shift
+end
+if ($#args != 1) goto usage
+
+# sun (at least) seems to need the socket library 
+# linux does not
+set sockets = ""
+
+# check the hardware architecture:
+set sys=`uname -s` 
+switch ($sys)
+ case IRIX64:
+   set arch="irix";
+   breaksw;
+ case SunOS:
+   set ver=`uname -r | awk '{print substr($1,1,1)}'`;
+   if ($ver == 5) then
+     set arch="sol";
+   else 
+     set arch="sun4";
+   endif
+   set sockets = "libsocket.a libnsl.a"
+   breaksw;
+ case Linux:
+   set arch="linux";
+   if (-e /etc/sidious.config) set arch="sid";
+   set mach=`uname -m`
+   if ("$mach" == "x86_64") then
+    set arch="lin64";
+   endif
+   breaksw;
+ case HP-UX:
+    set arch="hpux";
+    breaksw;
+ default:
+   echo "unknown architecture";
+   exit 1;
+   breaksw;
+endsw
+echo "setting architecture to: $arch" 
+
+# set up the basic directory names:
+if ($root == "") then
+    set root = `pwd`
+endif
+set inc = $root/include/$arch
+set lib = $root/lib/$arch
+
+# check for basic libraries
+set fail = 0
+foreach f ( libpng.a libjpeg.a libreadline.a libtermcap.a $sockets )
+    foreach g ( /usr/lib $lib )
+	set name = "$g/$f"
+	if (-e $name) then
+	    echo "found $g/$f"
+	    goto next_lib;
+	endif
+    end
+    echo "missing $f"
+    set fail = 1
+next_lib:
+    continue
+end
+
+if ($fail) then
+  echo "your installation is missing some important libraries"
+  echo "please find them and install them in $lib"
+  exit 1
+endif    
+
+# check for basic libraries
+set fail = 0
+foreach f ( libX11.a )
+    foreach g ( /usr/lib $lib /usr/X11R6/lib /usr/openwin/lib )
+	set name = "$g/$f"
+	if (-e $name) then 
+	    echo "found $g/$f"
+	    set xlib = $g
+	    goto next_xlib;
+	endif
+    end
+    echo "missing $f"
+    set fail = 1
+next_xlib:
+    continue
+end
+
+if ($fail) then
+  echo "your installation is missing some important libraries"
+  echo "please find them and install them in $lib"
+  exit 1
+endif    
+
+# check for X11 headers
+set fail = 0
+foreach f ( X11/X.h )
+    foreach g ( /usr/include $inc /usr/X11R6/include /usr/openwin/include )
+	set name = "$g/$f"
+	if (-e $name) then 
+	    echo "found $g/$f"
+	    set xinc = $g
+	    goto next_xinc;
+	endif
+    end
+    echo "missing $f"
+    set fail = 1
+next_xinc:
+    continue
+end
+
+if ($fail) then
+  echo "your installation is missing some important libraries"
+  echo "please find them and install them in $lib"
+  exit 1
+endif    
+
+echo ARCH: $arch
+echo ROOT: $root
+echo XINC: $xinc
+echo XLIB: $xlib
+
+if (-e Configure) then
+  mv Configure Configure.bak
+endif
+
+if ($vararch) then
+  cat Configure.in | sed "s|ROOTDIR|$root|" | sed "s|^\s*ARCH|# ARCH|"   | sed "s|XINCDIR|$xinc|" | sed "s|XLIBDIR|$xlib|" > Configure
+else 
+  cat Configure.in | sed "s|ROOTDIR|$root|" | sed "s|ARCHVAL|$arch|" | sed "s|XINCDIR|$xinc|" | sed "s|XLIBDIR|$xlib|" > Configure
+endif 
+
+exit 0
+
+usage:
+ echo "USAGE: configure [--prefix (dir)] [--vararch]"
+ echo "set the installation directory root with --prefix"
+ echo "if you define the environment variable $ARCH, you can set --vararch"
+ exit 2;
Index: /trunk/Ohana/src/addrefs/Makefile
===================================================================
--- /trunk/Ohana/src/addrefs/Makefile	(revision 2509)
+++ /trunk/Ohana/src/addrefs/Makefile	(revision 2510)
@@ -14,5 +14,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -39,4 +39,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -44,4 +45,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/addspphot/Makefile
===================================================================
--- /trunk/Ohana/src/addspphot/Makefile	(revision 2509)
+++ /trunk/Ohana/src/addspphot/Makefile	(revision 2510)
@@ -13,5 +13,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -39,4 +39,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -44,4 +45,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/addstar/Makefile
===================================================================
--- /trunk/Ohana/src/addstar/Makefile	(revision 2509)
+++ /trunk/Ohana/src/addstar/Makefile	(revision 2510)
@@ -13,5 +13,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -39,4 +39,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -44,4 +45,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/addusno/Makefile
===================================================================
--- /trunk/Ohana/src/addusno/Makefile	(revision 2509)
+++ /trunk/Ohana/src/addusno/Makefile	(revision 2510)
@@ -18,5 +18,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -43,4 +43,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -48,4 +49,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/delstar/Makefile
===================================================================
--- /trunk/Ohana/src/delstar/Makefile	(revision 2509)
+++ /trunk/Ohana/src/delstar/Makefile	(revision 2510)
@@ -15,5 +15,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -41,4 +41,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -46,4 +47,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/elixir/Makefile
===================================================================
--- /trunk/Ohana/src/elixir/Makefile	(revision 2509)
+++ /trunk/Ohana/src/elixir/Makefile	(revision 2510)
@@ -14,6 +14,6 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
-LIBS	= 	-L$(LLIB) -lFITS -lohana -lsocket -lnsl -lm 
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
+LIBS	= 	-L$(LLIB) -lFITS -lohana -lm -lsocket -lnsl
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
 CCFLAGS	=	$(INCS) $(LIBS) 
@@ -41,4 +41,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(ELIXIR)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(ELIXIR) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -46,4 +47,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/fixcat/Makefile
===================================================================
--- /trunk/Ohana/src/fixcat/Makefile	(revision 2509)
+++ /trunk/Ohana/src/fixcat/Makefile	(revision 2510)
@@ -15,5 +15,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -41,4 +41,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -46,4 +47,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/gastro/Makefile
===================================================================
--- /trunk/Ohana/src/gastro/Makefile	(revision 2509)
+++ /trunk/Ohana/src/gastro/Makefile	(revision 2510)
@@ -15,6 +15,6 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
-LIBS	= 	-L$(LLIB) -lFITS -lsocket -lnsl -lohana -lm 
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
+LIBS	= 	-L$(LLIB) -lFITS -lohana -lm -lsocket -lnsl 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
 CCFLAGS	=	$(INCS) $(LIBS) 
@@ -37,7 +37,9 @@
 
 $(BIN)/extract: $(EOBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(EOBJ) -o $(BIN)/extract $(CCFLAGS) 
 
 install.extract:
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	rm -f $(DESTBIN)/extract
 	cp $(BIN)/extract   $(DESTBIN)/
@@ -53,7 +55,9 @@
 
 $(BIN)/simulate: $(SOBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(SOBJ) -o $(BIN)/simulate.$(ARCH) $(CCFLAGS) 
 
 install.simulate:
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	rm -f $(DESTBIN)/simulate
 	cp $(BIN)/simulate.$(ARCH) $(DESTBIN)/simulate
@@ -80,4 +84,5 @@
 
 $(BIN)/gastro.$(ARCH): $(GOBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(GOBJ) -o $(BIN)/gastro.$(ARCH) $(CCFLAGS) 
 
@@ -85,4 +90,5 @@
 
 $(DESTBIN)/gastro: $(BIN)/gastro.$(ARCH)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	rm -f $(DESTBIN)/gastro
 	cp $(BIN)/gastro.$(ARCH)   $(DESTBIN)/gastro
@@ -103,4 +109,5 @@
 
 $(BIN)/gscdump.$(ARCH): $(DOBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(DOBJ) -o $(BIN)/gscdump.$(ARCH) $(CCFLAGS) 
 
@@ -108,4 +115,5 @@
 
 $(DESTBIN)/gscdump: $(BIN)/gscdump.$(ARCH)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	rm -f $(DESTBIN)/gscdump
 	cp $(BIN)/gscdump.$(ARCH)   $(DESTBIN)/gscdump
@@ -122,4 +130,5 @@
 
 $(BIN)/astro: $(AOBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(AOBJ) -o $(BIN)/astro $(CCFLAGS) 
 
@@ -135,4 +144,5 @@
 
 $(BIN)/rastro: $(ROBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(ROBJ) -o $(BIN)/rastro $(CCFLAGS) 
 
Index: /trunk/Ohana/src/gastro2/Makefile
===================================================================
--- /trunk/Ohana/src/gastro2/Makefile	(revision 2509)
+++ /trunk/Ohana/src/gastro2/Makefile	(revision 2510)
@@ -13,5 +13,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -63,4 +63,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -68,4 +69,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/gcompare/Makefile
===================================================================
--- /trunk/Ohana/src/gcompare/Makefile	(revision 2509)
+++ /trunk/Ohana/src/gcompare/Makefile	(revision 2510)
@@ -12,5 +12,5 @@
 DESTMAN	=	$(LMAN)
 
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	$(INCS) 
@@ -37,8 +37,9 @@
 
 $(BIN)/%.$(ARCH) : $(SRC)/%.$(ARCH).o $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $^ -o $@ $(LFLAGS)
 
 $(DESTBIN)/%: $(BIN)/%.$(ARCH)
-	mkdir -p $(DESTBIN)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$*
 	cp $(BIN)/$*.$(ARCH) $(DESTBIN)/$*
Index: /trunk/Ohana/src/getstar/Makefile
===================================================================
--- /trunk/Ohana/src/getstar/Makefile	(revision 2509)
+++ /trunk/Ohana/src/getstar/Makefile	(revision 2510)
@@ -13,5 +13,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -36,4 +36,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -41,4 +42,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/gophot/Makefile
===================================================================
--- /trunk/Ohana/src/gophot/Makefile	(revision 2509)
+++ /trunk/Ohana/src/gophot/Makefile	(revision 2510)
@@ -14,5 +14,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS) 
@@ -48,4 +48,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -53,4 +54,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/imclean/Makefile
===================================================================
--- /trunk/Ohana/src/imclean/Makefile	(revision 2509)
+++ /trunk/Ohana/src/imclean/Makefile	(revision 2510)
@@ -13,5 +13,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -32,4 +32,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -37,4 +38,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/kapa/Makefile
===================================================================
--- /trunk/Ohana/src/kapa/Makefile	(revision 2509)
+++ /trunk/Ohana/src/kapa/Makefile	(revision 2510)
@@ -22,5 +22,5 @@
 DESTMAN	=	$(LMAN)
 #
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 #LIBS	= 	-L$(LLIB) $(XLIB) -lFITS -lohana -lX11 -lm
 LIBS	= 	-L$(LLIB) $(XLIB) -lFITS -lohana -lX11 -lsocket -lnsl -lpng -lz -lm
@@ -83,4 +83,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -88,4 +89,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/kii/Makefile
===================================================================
--- /trunk/Ohana/src/kii/Makefile	(revision 2509)
+++ /trunk/Ohana/src/kii/Makefile	(revision 2510)
@@ -20,5 +20,5 @@
 DESTMAN	=	$(LMAN)
 #
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) $(XLIB) -lohana -lFITS -ljpeg -lX11 -lsocket -lnsl -lm
 # LIBS	= 	-L$(LLIB) $(XLIB) -lohana -lFITS -ljpeg -lX11 -lsocket -lnsl -lm -static
@@ -98,4 +98,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -103,4 +104,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/libdummy/Makefile
===================================================================
--- /trunk/Ohana/src/libdummy/Makefile	(revision 2509)
+++ /trunk/Ohana/src/libdummy/Makefile	(revision 2510)
@@ -3,4 +3,8 @@
 # are not needed for linux.  creating and empty, dummy library allows 
 # the linking lines to be identical
+
+include ../../Configure
+
+DESTLIB	=	$(LLIB)
 
 default: libdummy
@@ -13,8 +17,8 @@
 	ar rcv libsocket.a dummy.o
 	ranlib libsocket.a
-	cp libsocket.a ../../lib/$(ARCH)/
+	cp libsocket.a $(DESTLIB)
 	ar rcv libnsl.a dummy.o
 	ranlib libnsl.a
-	cp libnsl.a ../../lib/$(ARCH)/
+	cp libnsl.a $(DESTLIB)
 
 # utilities #################################################
Index: /trunk/Ohana/src/libfits/Makefile
===================================================================
--- /trunk/Ohana/src/libfits/Makefile	(revision 2509)
+++ /trunk/Ohana/src/libfits/Makefile	(revision 2510)
@@ -12,5 +12,5 @@
 DESTMAN	=	$(LMAN)
 
-INCS	=	-I$(INC)  -I$(LINC)/$(ARCH)
+INCS	=	-I$(INC) 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS) -D$(ARCH)
 LFLAGS	=	-c $(INCS)
@@ -64,4 +64,5 @@
 
 $(LIB)/libFITS.$(ARCH).a: $(LIBOBJ)
+	@if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi
 	rm -f $(LIB)/libFITS.$(ARCH).a
 	ar rcv $(LIB)/libFITS.$(ARCH).a $(LIBOBJ)
Index: /trunk/Ohana/src/libohana/Makefile
===================================================================
--- /trunk/Ohana/src/libohana/Makefile	(revision 2509)
+++ /trunk/Ohana/src/libohana/Makefile	(revision 2510)
@@ -11,5 +11,5 @@
 DESTMAN	=	$(LMAN)
 
-INCS	= 	-I$(LINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(LINC)
 CFLAGS	=	-Wunused -o $*.$(ARCH).o $(INCS) 
 LFLAGS	=	-c $(INCS)
@@ -36,4 +36,5 @@
 
 $(LIB)/libohana.$(ARCH).a: $(HOBJ) $(LOBJ)
+	@if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi
 	rm -f $(LIB)/libohana.$(ARCH).a
 	ar rcv $(LIB)/libohana.$(ARCH).a $(LOBJ)
Index: /trunk/Ohana/src/lightcurve/Makefile
===================================================================
--- /trunk/Ohana/src/lightcurve/Makefile	(revision 2509)
+++ /trunk/Ohana/src/lightcurve/Makefile	(revision 2510)
@@ -15,5 +15,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lohana -lFITS -lm 
 CFLAGS	=	-o $*.o $(INCS) 
@@ -34,8 +34,10 @@
 
 $(BIN)/$(PROGRAM): $(OBJS)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJS) -o $(BIN)/$(PROGRAM) $(CCFLAGS)
 
 # -----------------------
 install:
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 #	rm -f $(DESTMAN)/$(PROGRAM).1
Index: /trunk/Ohana/src/markrock/Makefile
===================================================================
--- /trunk/Ohana/src/markrock/Makefile	(revision 2509)
+++ /trunk/Ohana/src/markrock/Makefile	(revision 2510)
@@ -14,5 +14,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lohana -lFITS -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -44,4 +44,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -49,4 +50,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/markstar/Makefile
===================================================================
--- /trunk/Ohana/src/markstar/Makefile	(revision 2509)
+++ /trunk/Ohana/src/markstar/Makefile	(revision 2510)
@@ -14,5 +14,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -44,4 +44,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -49,4 +50,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/misc/Makefile
===================================================================
--- /trunk/Ohana/src/misc/Makefile	(revision 2509)
+++ /trunk/Ohana/src/misc/Makefile	(revision 2510)
@@ -15,5 +15,5 @@
 
 #  
-INCS	= 	-I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH) -Wunused
+INCS	= 	-I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm
 CFLAGS	=	
@@ -51,4 +51,5 @@
 
 $(BIN)/fakestars.$(ARCH): $(FAKESRC)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) -o $(BIN)/fakestars.$(ARCH) $(FAKESRC) $(LIBS) $(CCFLAGS)
 
@@ -56,5 +57,6 @@
 	cp $(BIN)/fakestars.$(ARCH) $(DESTBIN)/fakestars
 
-$(BESTBIN)/cfhtlog: $(SRC)/cfhtlog.$(ARCH)
+$(DESTBIN)/cfhtlog: $(SRC)/cfhtlog.$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	cp $(SRC)/cfhtlog.$(ARCH) $(DESTBIN)/
 
@@ -72,9 +74,9 @@
 
 $(BIN)/%.$(ARCH) : $(SRC)/%.$(ARCH).o
-	echo $(CC)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $^ -o $@ $(LIBS)
-	echo done building $@
 
 $(DESTBIN)/%: $(BIN)/%.$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$*
 	cp $(BIN)/$*.$(ARCH) $(DESTBIN)/$*
Index: /trunk/Ohana/src/nightd/Makefile
===================================================================
--- /trunk/Ohana/src/nightd/Makefile	(revision 2509)
+++ /trunk/Ohana/src/nightd/Makefile	(revision 2510)
@@ -13,5 +13,5 @@
 
 #  
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lFITS -lohana -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -40,4 +40,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -45,4 +46,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/perl/Makefile
===================================================================
--- /trunk/Ohana/src/perl/Makefile	(revision 2509)
+++ /trunk/Ohana/src/perl/Makefile	(revision 2510)
@@ -51,4 +51,5 @@
 
 install:
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	for file in $(CODE); do \
 	(chmod +x src/$$file && cd $(DESTBIN) && rm -f $$file && ln -s $(HOME)/src/$$file .); \
Index: /trunk/Ohana/src/photdbc/Makefile
===================================================================
--- /trunk/Ohana/src/photdbc/Makefile	(revision 2509)
+++ /trunk/Ohana/src/photdbc/Makefile	(revision 2510)
@@ -14,5 +14,5 @@
 
 #
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lohana -lFITS -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -52,4 +52,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -57,4 +58,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/relphot/Makefile
===================================================================
--- /trunk/Ohana/src/relphot/Makefile	(revision 2509)
+++ /trunk/Ohana/src/relphot/Makefile	(revision 2510)
@@ -14,5 +14,5 @@
 
 #
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lohana -lFITS -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS)
@@ -64,4 +64,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
Index: /trunk/Ohana/src/shell/Makefile
===================================================================
--- /trunk/Ohana/src/shell/Makefile	(revision 2509)
+++ /trunk/Ohana/src/shell/Makefile	(revision 2510)
@@ -34,4 +34,5 @@
 
 install:
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	for file in $(CODE); do \
 	(chmod +x src/$$file && cd $(DESTBIN) && rm -f $$file && ln -s $(HOME)/src/$$file .); \
Index: /trunk/Ohana/src/skycalc/Makefile
===================================================================
--- /trunk/Ohana/src/skycalc/Makefile	(revision 2509)
+++ /trunk/Ohana/src/skycalc/Makefile	(revision 2510)
@@ -12,5 +12,5 @@
 DESTMAN	=	$(LMAN)
 
-INCS	=	-I$(INC) -I$(LINC)  -I$(LINC)/$(ARCH)
+INCS	=	-I$(INC) -I$(LINC)
 LIBS	= 	-L$(LLIB)
 CFLAGS	=	-g -o $*.$(ARCH).o $(INCS)
@@ -30,4 +30,5 @@
 
 $(LIB)/libskycalc.$(ARCH).a: $(OBJ)
+	@if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi
 	rm -f $(LIB)/libskycalc.$(ARCH).a
 	ar rcv $(LIB)/libskycalc.$(ARCH).a $(OBJ)
@@ -48,12 +49,18 @@
 
 dusktime: skycalc
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	$(CC) $(CCFLAGS) -g -o $(BIN)/dusktime.$(ARCH) $(SRC)/dusktime.c -lskycalc -lm -lohana
 	cp $(BIN)/dusktime.$(ARCH) $(DESTBIN)/dusktime
 
 moondata: skycalc
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	$(CC) $(CCFLAGS) -g -o $(BIN)/moondata.$(ARCH) $(SRC)/moondata.c -lskycalc -lm -lohana
 	cp $(BIN)/moondata.$(ARCH) $(DESTBIN)/moondata
 
 sundata: skycalc
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	$(CC) $(CCFLAGS) -g -o $(BIN)/sundata.$(ARCH) $(SRC)/sundata.c -lskycalc -lm -lohana
 	cp $(BIN)/sundata.$(ARCH) $(DESTBIN)/sundata
Index: /trunk/Ohana/src/tcl/Makefile
===================================================================
--- /trunk/Ohana/src/tcl/Makefile	(revision 2509)
+++ /trunk/Ohana/src/tcl/Makefile	(revision 2510)
@@ -11,4 +11,5 @@
 
 install:
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	for file in $(CODE); do \
 	(cd $(DESTBIN); rm -f $$file; ln -s $(HOME)/src/$$file .); \
Index: /trunk/Ohana/src/uniphot/Makefile
===================================================================
--- /trunk/Ohana/src/uniphot/Makefile	(revision 2509)
+++ /trunk/Ohana/src/uniphot/Makefile	(revision 2510)
@@ -14,5 +14,5 @@
 
 #
-INCS	= 	-I$(INC) -I$(LINC) -I$(XINC) -I$(LINC)/$(ARCH)
+INCS	= 	-I$(INC) -I$(LINC) -I$(XINC)
 LIBS	= 	-L$(LLIB) -lohana -lFITS -lm 
 CFLAGS	=	-o $*.$(ARCH).o $(INCS) -Wall
@@ -47,4 +47,5 @@
 
 $(BIN)/$(PROGRAM).$(ARCH): $(OBJ)
+	@if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi
 	$(CC) $(OBJ) -o $(BIN)/$(PROGRAM).$(ARCH) $(CCFLAGS)
 
@@ -52,4 +53,5 @@
 
 $(DESTBIN)/$(PROGRAM): $(BIN)/$(PROGRAM).$(ARCH)
+	@if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi
 	rm -f $(DESTBIN)/$(PROGRAM)
 	cp $(BIN)/$(PROGRAM).$(ARCH) $(DESTBIN)/$(PROGRAM)
