# src/Makefile -- MiNTLib.
# Copyright (C) 1999 Guido Flohr <gufl0000@stud.uni-sb.de>
#
# This file is part of the MiNTLib project, and may only be used
# modified and distributed under the terms of the MiNTLib project
# license, COPYMINT.  By continuing to use, modify, or distribute
# this file you indicate that you have read the license and
# understand and accept it fully.

SHELL = /bin/sh

srcdir = .
top_srcdir = ..
subdir = src

include $(top_srcdir)/configvars
ifneq ($(USE_WEAK_SYMBOLS), yes)
-include $(srcdir)/SYSCALLS
endif

# Make install-libs work.
LIBS = 

GENSYS = AWK=$(AWK) $(srcdir)/gensys

default: all

ifeq ($(USE_WEAK_SYMBOLS), yes)
all-here: syscalls.h
else
all-here: syscalls.h SYSCALLS $(SYSCALLS)
endif

dont_install_libs = yes
include $(top_srcdir)/rules $(top_srcdir)/phony

install-include:

install-man:

uninstall-include:

uninstall-man:

distdir: distdir-local

# We have to do some special things for the support subdirectories.
support_dirs := crlf lattice purec purec/unixname sozobon
support_files := $(foreach dir,$(support_dirs),$(wildcard $(dir)/*))

DISTFILES += $(support_files)

distdir-local:
	for subdir in $(support_dirs); do \
	  test -d $(distdir)/$$subdir \
	  || mkdir $(distdir)/$$subdir \
	  || exit 1; \
	  chmod 777 $(distdir)/$$subdir; \
	done

bindistdir:

syscalls.h: $(srcdir)/syscalls.list $(srcdir)/gensys
	$(GENSYS) -array $(srcdir)/syscalls.list >$@
	
ifneq ($(USE_WEAK_SYMBOLS), yes)
SYSCALLS: $(srcdir)/syscalls.list $(srcdir)/gensys
	$(GENSYS) -syscalls $(srcdir)/syscalls.list >$@

$(SYSCALLS): $(srcdir)/syscalls.list $(srcdir)/gensys
	@echo "Generating $@ ..."
	@call=`echo $@ | sed 's,_sys\\.c,,g'`; \
	$(GENSYS) -sysdefs $(srcdir)/syscalls.list $$call >$@
endif

