# ----- Makefile ------------------------------------------------
# Makefile for the lua language binding of Dazuko

CFLAGS += -I..
DAZUKO_LDFLAGS = -L../library -ldazuko

# Lua is not a standalone scripting language and does not have
# the "extension management" and "makefile maker" tools other
# languages like Python, Ruby, or Perl have -- so we have to
# setup our own build environment :(  yes this is just a start
UNAME = $(shell uname | tr '/-' '__')
ifeq ($(UNAME),Darwin)
  DYN = -dynamic -bundle
else
  DYN = -shared
endif
ifeq ($(UNAME),Linux)
  LDFLAGS += -ldl -lm
endif

TARGETS = libluadazuko.so # example

all: $(TARGETS)

libluadazuko.so: libdazuko.o
	$(CC) $(CFLAGS) $(DYN) -o $@ $< $(LDFLAGS) -llualib -llua $(DAZUKO_LDFLAGS)

example: example.o
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -llualib -llua $(DAZUKO_LDFLAGS)

clean:
	$(RM) *.o *.a
	$(RM) libluadazuko.so example

# ----- E O F ---------------------------------------------------
