#----------------------------------------------------------------------------#
# Makefile for BASIClib. Woohoo.
#
#
#                 Do NOT edit this file if you don't have to!
#            Global customization is done in the "default.mak" file.
#
#
#  Copyright (c) 1999 Ryan C. Gordon and Gregory S. Read.
#----------------------------------------------------------------------------#

include default.mak

DYNLIBBASE = $(strip libBASIC.so)
DYNLIBWHOLE = $(strip $(DYNLIBBASE).$(WHOLEVERSION))
DYNLIBMAJOR = $(strip $(DYNLIBBASE).$(MAJORVER))

all : $(DYNLIBBASE) console

# compatibility with old make system.
linux : all

# compatibility with old make system.
win32 : all

$(DYNLIBBASE) : $(DYNLIBMAJOR)
	ln -sf $(DYNLIBMAJOR) $(DYNLIBBASE)

$(DYNLIBMAJOR) : $(DYNLIBWHOLE)
	ln -sf $(DYNLIBWHOLE) $(DYNLIBMAJOR)

$(DYNLIBWHOLE) : $(OBJS)
	$(LINKER) $(LOPTIONS) $(DYNLIBWHOLE) $(OBJS) $(GCLIB)

%.o : %.c
	$(CC) $(COPTIONS) $@ $<

# temp fix. !!!
LowLevelFunctions.o : LowLevelFunctions.c
	$(CC) $(COPTIONS) LowLevelFunctions.o -O3 LowLevelFunctions.c

console:
	cd consoledrivers ; $(MAKE) all

about:
	-@clear
	@cat ../docs/about.txt |more

install: all
	cp $(DYNLIBWHOLE) /usr/local/lib
	ln -sf $(INSTPREFIX)/$(DYNLIBWHOLE) $(INSTPREFIX)/$(DYNLIBMAJOR)
	ln -sf $(INSTPREFIX)/$(DYNLIBMAJOR) $(INSTPREFIX)/$(DYNLIBBASE)
	cd consoledrivers ; $(MAKE) install
	ldconfig
	cp vbslacker.lang /etc
	cp vbslacker.cons /etc
	sync

lines:
	@wc -l $(wildcard *.c) $(wildcard *.h) $(wildcard Makefile*)

clean:
	cd consoledrivers ; $(MAKE) clean
	rm -f $(wildcard *core)
	rm -f $(wildcard *.o)
	rm -f $(wildcard *.obj)
	rm -f $(wildcard *.exe)
	rm -f $(wildcard *.dll)
	rm -f $(wildcard *.so*)
	rm -f $(wildcard *.a)

# end of Makefile ...

