SHELL = /bin/sh

@SET_MAKE@
@SET_GCC@
CFLAGS= @CFLAGS@ -I$(DETECT) -I$(IMC) -I$(MOSINC)
LIBIMC= $(IMC)/libimc.a 
#MOSBIN @exec_prefix@/bin
LIBARGS = $(MOSLIB)/getargs.o $(MOSLIB)/paint_sub.o
LIBDETECT= detect_sub3.o imopr.o 

LIBS= $(LIBDETECT) $(LIBIMC) $(LIBUTIL) $(LIBARGS) @LIBS@
PROGS=starsel3

binaries: $(PROGS)
 
starsel3 : starsel3.o apphot_sub.o $(LIBDETECT) $(LIBIMC) $(LIBARGS)
	$(CC) $(CFLAGS) -o $@ $@.o apphot_sub.o $(LIBS)

$(LIBIMC): 
	(cd $(IMC); $(MAKE) IMC=$(IMC) MOSINC=$(MOSINC) \
	 MOSLIB=$(MOSLIB) MOSBIN=$(MOSBIN))

$(LIBUTIL): 
	(cd ../libsrc; $(MAKE) IMC=$(IMC) MOSINC=$(MOSINC) \
	 MOSLIB=$(MOSLIB) MOSBIN=$(MOSBIN))

$(LIBARGS):
	(cd ../getarg; $(MAKE) IMC=$(IMC) MOSINC=$(MOSINC) \
	 MOSLIB=$(MOSLIB) MOSBIN=$(MOSBIN))

install: $(PROGS)
	cp $(PROGS) $(MOSBIN)/

# shells to be written

clean: 
	rm -f *.o *~

distclean: clean
	rm -f $(PROGS)

all: $(PROGS) clean install
