it: command include library library.so

clean: EXPORT INTERNAL
	rm -f `cat EXPORT INTERNAL`

skalibs-version.h: stupid skalibs-version.h.stupid
	./stupid < skalibs-version.h.stupid > skalibs-version.h

uint16.h: sysdeps uint64.h uint16-header uint16-footer uint16-stdinth uint16-inttypesh uint16-default uint16-lendian uint16-bendian
	rm -f uint16.h
	( \
	  cat uint16-header ; \
	  if grep +stdinth sysdeps >/dev/null ; then cat uint16-stdinth ; \
	  elif grep +inttypesh sysdeps >/dev/null ; then cat uint16-inttypesh ; \
	  else cat uint16-default ; \
	  fi ; \
	  if grep +little_endian sysdeps >/dev/null ; then cat uint16-lendian ; \
	  elif grep +big_endian sysdeps >/dev/null ; then cat uint16-bendian ; \
	  else echo "Error ! Unsupported endianness" 1>&2 ; ./crash ; \
	  fi ; \
	  cat uint16-footer \
	) > uint16.h

uint32.h: sysdeps uint64.h uint32-header uint32-footer uint32-stdinth uint32-inttypesh uint32-ulong32 uint32-noulong32 uint32-lendian uint32-bendian
	rm -f uint32.h
	( \
	  cat uint32-header ; \
	  if grep +stdinth sysdeps >/dev/null ; then cat uint32-stdinth ; \
	  elif grep +inttypesh sysdeps >/dev/null ; then cat uint32-inttypesh ; \
	  elif grep +ulong32 sysdeps >/dev/null ; then cat uint32-ulong32 ; \
	  else cat uint32-noulong32 ; \
	  fi ; \
	  if grep +little_endian sysdeps >/dev/null ; then cat uint32-lendian ; \
	  elif grep +big_endian sysdeps >/dev/null ; then cat uint32-bendian ; \
	  else echo "Error ! Unsupported endianness" 1>&2 ; ./crash ; \
	  fi ; \
	  cat uint32-footer \
	) > uint32.h

uint64.h: sysdeps uint64-header uint64-footer uint64-ulong64 uint64-noulong64 uint64-lendian uint64-bendian
	rm -f uint64.h
	( \
	  cat uint64-header ; \
	  if grep +ulong64 sysdeps >/dev/null ; then cat uint64-ulong64 ; \
	  else cat uint64-noulong64 ; \
          fi ; \
	  if grep +little_endian sysdeps >/dev/null ; then cat uint64-lendian ; \
	  elif grep +big_endian sysdeps >/dev/null ; then cat uint64-bendian ; \
	  else echo "Error ! Unsupported endianness" 1>&2 ; ./crash ; \
	  fi ; \
	  cat uint64-footer \
	) > uint64.h

direntry.h: sysdeps direntry.h1 direntry.h2 direntry-header direntry-footer
	rm -f direntry.h
	( \
	  cat direntry-header ; \
	  if grep +dirent sysdeps >/dev/null ; then cat direntry.h2 ; \
	  else cat direntry.h1 ; \
	  fi ; \
	  cat direntry-footer \
	) > direntry.h

error.h: systype sysdeps error-addrinuse error-already error-proto error-header error-footer
	rm -f error.h
	( \
	  cat error-header ; \
	  if cut -d- -f1 systype | grep bsd >/dev/null ; then cat error-addrinuse ; \
	  else cat error-already ; \
	  fi ; \
	  if grep +eproto sysdeps >/dev/null ; then true ; \
	  else cat error-proto ; \
	  fi ; \
	  cat error-footer \
	) > error.h

select.h: sysdeps select.h1 select.h2
	rm -f select.h
	( \
	  if grep +sysselect sysdeps >/dev/null ; then cat select.h2 ; \
	  else cat select.h1 ; \
	  fi \
	) > select.h

iopause.h: sysdeps iopause.h1 iopause.h2 iopause.h3 iopause.h4
	rm -f iopause.h
	( \
	  if grep +poll sysdeps >/dev/null ; then \
	    if grep +pollh sysdeps >/dev/null ; then cat iopause.h2 ; \
	    elif grep +syspollh sysdeps >/dev/null ; then cat iopause.h3 ; \
	    else cat iopause.h4 ; \
	    fi \
	  else cat iopause.h1 ; \
	  fi \
	) > iopause.h

shglob.h: sysdeps shglob.h1 shglob.h2
	rm -f shglob.h
	( \
	  if grep +posixglob sysdeps >/dev/null ; then cat shglob.h2 ; \
	  else cat shglob.h1 ; \
	  fi \
	) > shglob.h

syssocket.h: sysdeps syssocket.h1 syssocket.h2 syssocket-header syssocket-footer
	rm -f syssocket.h
	( \
	  cat syssocket-header ; \
	  if grep +oksyssocket sysdeps >/dev/null ; then cat syssocket.h2 ; \
	  else cat syssocket.h1 ; \
	  fi ; \
	  cat syssocket-footer \
	) > syssocket.h


command:

include: gccattributes.h skalibs-version.h uint16.h uint32.h uint64.h direntry.h error.h select.h iopause.h shglob.h syssocket.h

library:

library.so:
