GCC=gcc
FLAGS=-I ../sources.cc/atoms/include/


#### OS autodetection part of makefile ####

# for Linux - debian
ifeq ($(OSTYPE),linux-gnu)
LIBS=-lm
GCC = g++
endif

# for Linux - Slackware
ifeq ($(OSTYPE),linux)
LIBS+= -lstdc++
endif

# for Linux - Red Hat
ifeq ($(OSTYPE),Linux)
LIBS+= -lstdc++
endif
#end of Linux

# for sun
ifeq ($(OSTYPE),solaris)
LIBS=-lm
endif

ifeq ($(OSTYPE),sunos4)
LIBS=-lm -lstdc++
endif
#end of sun

#for OS/2
ifneq "$(OS2_SHELL)" ""
LIBS=-s -lstdcpp
endif

# for aix
ifeq ($(OSTYPE),aix)
LIBS=-lm
endif
#end of aix


#Nothing is an indentifier for DOS? Too bad.
ifeq ($(OSTYPE),)
ifeq ($(HOSTTYPE),iris4d)
LIBS=-lm
else
OSTYPE = dos
endif
endif



#library components
LIBS+=../sources.cc/atoms/libatoms.a



.SUFFIXES: .c .cc $(OBJ) .exe

.c$(OBJ):
	$(GCC) $(FLAGS) $(DEBUG) -c $*.c $(ERROR) -o $*$(OBJ) $(GETTEXT)

.cc$(OBJ):
	$(GCC) $(FLAGS) $(DEBUG) -c $*.cc $(ERROR) -o $*$(OBJ) $(GETTEXT) 

$(OBJ).exe:
	$(GCC) $*$(OBJ) $(LIBS) $(ERROR)


menucfg.exe: menucfg.cc ../sources.cc/atoms/libatoms.a
	$(GCC) $(FLAGS) -o menucfg.exe menucfg.cc $(LIBS)

inst_gt.exe: inst_gt.cc ../sources.cc/atoms/libatoms.a
	$(GCC) $(FLAGS) -o inst_gt.exe inst_gt.cc ../sources.cc/wp2lfuti.cc $(LIBS)


../sources.cc/atoms/libatoms.a:
	make -C ../sources.cc/atoms libatoms.a


clean:
	rm -f igt.bat *.exe *.com *.o *.obj *.bak *.bkp *.map *.rpo *.~?? core *.swp *.ilk *.tfa *.lk1 *.mk1 *.mk *.err *.pch *.ncb *.opt *.plg *.out *.cv4

distclean: clean
	rm makefile
	cp makefile.gen makefile

generic:
	rm makefile
	cp makefile.gen makefile

