LIB_LINEDIT = @LIB_LINEDIT@
CC          = @CC@
CFLAGS      = @CFLAGS_MACHINE@ @CFLAGS@
LDLIBS      = @LDLIBS@
AR_RC       = @AR_RC@
RANLIB      = @RANLIB@

LIBNAME = $(LIB_LINEDIT)
OBJLIB  = linedit@OBJ_SUFFIX@ stty@OBJ_SUFFIX@ char_io@OBJ_SUFFIX@

.SUFFIXES:
.SUFFIXES: @OBJ_SUFFIX@ .c $(SUFFIXES)

.c@OBJ_SUFFIX@:
	$(CC) -c $(CFLAGS) $*.c

$(LIBNAME): $(OBJLIB)
	rm -f $(LIBNAME)
	$(AR_RC)@AR_SEP@$(LIBNAME) $(OBJLIB)
	$(RANLIB) $(LIBNAME)	


clean:
	rm -f *@OBJ_SUFFIX@ $(LIBNAME) 


distclean: clean
	rm -f test_linedit@EXE_SUFFIX@ test_noecho@EXE_SUFFIX@


# test files
# under win32: use make W=Y test_linedit.exe (or test_noecho.exe) to
# link the GUI console
# You can also use gplc test_linedit.c and gplc --gui-console test_linedit.c

W32LNK=W32GUICons/w32gc_interf.obj W32GUICons/GUICons.res W32GUICons/libw32guicons.lib /link /subsystem:windows

test_linedit@EXE_SUFFIX@: test_linedit@OBJ_SUFFIX@ $(LIBNAME)
	( if [ "$$W" != "Y" ]; then W=''; else W="$(W32LNK)"; fi; \
	$(CC) @CC_EXE_NAME_OPT@test_linedit@EXE_SUFFIX@ test_linedit@OBJ_SUFFIX@ $(LIBNAME) $(LDLIBS) $$W )

test_noecho@EXE_SUFFIX@: test_noecho@OBJ_SUFFIX@ $(LIBNAME)
	( if [ "$$W" != "Y" ]; then W=''; else W="$(W32LNK)"; fi; \
	$(CC) @CC_EXE_NAME_OPT@test_noecho@EXE_SUFFIX@ test_noecho@OBJ_SUFFIX@ $(LIBNAME) $(LDLIBS) $$W )


clean-test:
	rm -f test*@OBJ_SUFFIX@ test_linedit@EXE_SUFFIX@ test_noecho@EXE_SUFFIX@


