
#
# Makefile.QNX
# This file is included because the configure script broke
#

OBJS		= asmail.o safemalloc.o
PROG		= asmail

CC			= cc -M
CCFLAGS		= -Otx -mf -zp1 -w4

CP			= /bin/cp
MV			= /bin/mv
RM			= /bin/rm
RMF			= /bin/rm -f
CHDIR		= cd
RMFDIR		= /bin/rm -rf
MKDIR		= /bin/mkdir -p
STRIP		= /usr/local/bin/strip

INSTALL			= /usr/X11/bin/install -c
INSTALL_EXEC	= /usr/X11/bin/install -c -s -m 755
INSTALL_DATA	= /usr/X11/bin/install -c -m 644

INCS_X		= 
INCS_XPM	= 
INCLUDES	= $(INCS_X) $(INCS_XPM)

LIBS_X			=  -L/usr/lib/X11 -lX11_s -lXext -lXt_s -lXqnx_s -lsocket
LIBS_XPM		=  -lXpm
LIBS_JPEG		= 
LIBS_XEXTS		= 
LIBS_AFTERSTEP	= 
LIBRARIES		= $(LIBS_X) $(LIBS_XPM) $(LIBS_JPEG) $(LIBS_XEXTS) $(LIBS_AFTERSTEP)

AFTER_BIN_DIR	= /usr/X11/bin
AFTER_MAN_DIR	= /usr/local/man/man1
AFTER_LIB_DIR	= /usr/X11/lib/afterstep/$(PROG)

all:            $(PROG)

install.bin:	$(PROG)
		$(INSTALL_EXEC) $(PROG) $(AFTER_BIN_DIR)

install.icons:
		$(MKDIR) $(AFTER_LIB_DIR)/icons/cloud-e
		$(CHDIR) pixmaps; \
		ICONS=`ls -1 *.xpm`; \
		for i in $$ICONS; do \
		  $(INSTALL_DATA) $$i $(AFTER_LIB_DIR)/icons; \
		done
		$(CHDIR) pixmaps/cloud-e; \
		ICONS=`ls -1 *.xpm`; \
		for i in $$ICONS; do \
		  $(INSTALL_DATA) $$i $(AFTER_LIB_DIR)/icons/cloud-e; \
		done

install.man:
		$(INSTALL_DATA) $(PROG).man $(AFTER_MAN_DIR)/$(PROG).1

install.doc:
		$(MKDIR) $(AFTER_LIB_DIR)
		$(INSTALL_DATA) sample.asmailrc $(AFTER_LIB_DIR)

install:		install.bin install.icons install.man install.doc

uninstall:
		$(RMF) $(AFTER_BIN_DIR)/$(PROG)
		$(RMF) $(AFTER_MAN_DIR)/$(PROG).1
		$(RMFDIR) $(AFTER_LIB_DIR)

clean:
		$(RMF) $(PROG) *.err *.map *.o *~ *% *.b *.bak \#* core

distclean:
		$(RMF) $(PROG) config.cache config.log config.status Makefile.bak Makefile config.h configure.h *.err *.map *.o *~ *% *.b *.bak \#* core autoconf/Makefile.common autoconf/Makefile.common.lib autoconf/Makefile.defines

indent:
		SRCS=`echo "$(OBJS) " | sed "s/.o /.c /g"`; \
		for i in $$SRCS; do \
		  if (indent < $$i > /tmp/$$i); then \
		    mv /tmp/$$i $$i; \
		  fi; \
		done

config.h:
		echo '#define HAVE_SYS_TIME_H 1' >config.h
		echo '#define HAVE_SYS_WAIT_H 1' >>config.h
		echo '#define HAVE_USTAT_H 1' >>config.h
		echo '#define strcasecmp stricmp' >>config.h
		echo '#define strncasecmp strnicmp' >>config.h
		echo '#define isblank isspace' >>config.h

$(PROG):		config.h $(OBJS)
		$(CC) $(OBJS) $(LIBRARIES) $(EXTRA_LIBRARIES) -o $(@)

.c.o:
		$(CC) $(CCFLAGS) $(EXTRA_DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) -c $*.c

