diff --git a/common/libobjs.mif b/common/libobjs.mif index fda5fcff..a3e6ffda 100644 --- a/common/libobjs.mif +++ b/common/libobjs.mif @@ -9,6 +9,7 @@ TERM_HEADER = $(PDCURSES_SRCDIR)/term.h srcdir = $(PDCURSES_SRCDIR)/pdcurses demodir = $(PDCURSES_SRCDIR)/demos +testdir = $(PDCURSES_SRCDIR)/tests LIBOBJS = addch.$(O) addchstr.$(O) addstr.$(O) attr.$(O) beep.$(O) \ bkgd.$(O) border.$(O) clear.$(O) color.$(O) debug.$(O) delch.$(O) deleteln.$(O) \ @@ -26,3 +27,6 @@ mbrot$(E) newtest$(E) ozdemo$(E) picsview$(E) ptest$(E) rain$(E) \ speed$(E) test_pan$(E) testcurs$(E) widetest$(E) worm$(E) xmas$(E) DEMOS = $(DEMOS_EXCEPT_TUIDEMO) tuidemo$(E) + +TESTS = brk_test$(E) del_test$(E) focus$(E) ins_del$(E) keytest$(E) \ + opaque$(E) restart$(E) ripoff$(E) diff --git a/fb/Makefile b/fb/Makefile index 1be97a72..c43d18e8 100644 --- a/fb/Makefile +++ b/fb/Makefile @@ -80,20 +80,25 @@ ifeq ($(shell uname -s),FreeBSD) LDFLAGS += -L /usr/local/lib -ldrm endif -.PHONY: all libs clean demos +.PHONY: all libs clean demos tests all: libs libs: $(LIBCURSES) clean: - -$(RM) *.o trace $(LIBCURSES) $(DEMOS) + -$(RM) *.o trace $(LIBCURSES) $(DEMOS) $(TESTS) demos: libs $(DEMOS) ifneq ($(DEBUG),Y) $(STRIP) $(DEMOS) endif +tests: libs $(TESTS) +ifneq ($(DEBUG),Y) + $(STRIP) $(TESTS) +endif + $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) $(LIBFLAGS) $@ $? ifeq ($(LIBCURSES),lib$(LIBNAME).a) @@ -102,6 +107,7 @@ endif $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) +$(TESTS) : $(PDCURSES_CURSES_H) $(LIBCURSES) tui.o tuidemo.o : $(PDCURSES_CURSES_H) terminfo.o : $(TERM_HEADER) panel.o ptest: $(PANEL_HEADER) @@ -115,6 +121,9 @@ $(PDCOBJS) : %.o: $(osdir)/%.c $(DEMOS_EXCEPT_TUIDEMO): %: $(demodir)/%.c $(BUILD) $(DEMOFLAGS) -o$@ $< $(LDFLAGS) +$(TESTS): %: $(testdir)/%.c + $(BUILD) $(DEMOFLAGS) -o$@ $< $(LDFLAGS) + tuidemo$(E) : tuidemo.o tui.o $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) diff --git a/ncurses/Makefile b/ncurses/Makefile index af905dfc..88d9306d 100644 --- a/ncurses/Makefile +++ b/ncurses/Makefile @@ -14,12 +14,20 @@ else endif demodir = ../demos +testdir = ../tests DEMOS = calendar firework init_col mbrot newtest ozdemo picsview ptest \ rain speed testcurs test_pan widetest worm xmas +TESTS = brk_test del_test focus ins_del keytest opaque restart ripoff + all: $(DEMOS) tuidemo +tests: $(TESTS) + +$(TESTS) : %: $(testdir)/%.c + $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES) + $(DEMOS) : %: $(demodir)/%.c $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES) @@ -27,4 +35,4 @@ tuidemo : $(demodir)/tuidemo.c $(demodir)/tui.c $(CC) $(CFLAGS) -o$@ $(demodir)/tui.c $< $(LIBCURSES) clean: - rm -f $(DEMOS) tuidemo + rm -f $(DEMOS) tuidemo $(TESTS) diff --git a/sdl1/Makefile b/sdl1/Makefile index b2bb12f8..ec2a6ff0 100644 --- a/sdl1/Makefile +++ b/sdl1/Makefile @@ -62,20 +62,25 @@ LINK = $(CC) DEMOS += sdltest -.PHONY: all libs clean demos +.PHONY: all libs clean demos tests all: libs libs: $(LIBCURSES) $(LIBCURSES_SO) clean: - -$(RM) *.o trace $(LIBCURSES) $(LIBCURSES_SO) $(DEMOS) + -$(RM) *.o trace $(LIBCURSES) $(LIBCURSES_SO) $(DEMOS) $(TESTS) demos: $(DEMOS) ifneq ($(DEBUG),Y) strip $(DEMOS) endif +tests: $(TESTS) +ifneq ($(DEBUG),Y) + strip $(TESTS) +endif + install: ifneq ($(OS),Windows_NT) cp $(LIBCURSES_SO) /usr/local/lib @@ -98,6 +103,7 @@ $(LIBCURSES_SO) : $(LIBOBJS) $(PDCOBJS) $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_SDL_H) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) +$(TESTS) : $(PDCURSES_CURSES_H) $(LIBCURSES) tui.o tuidemo.o : $(PDCURSES_CURSES_H) terminfo.o : $(TERM_HEADER) panel.o ptest: $(PANEL_HEADER) @@ -108,6 +114,9 @@ $(LIBOBJS) : %.o: $(srcdir)/%.c $(PDCOBJS) : %.o: $(osdir)/%.c $(BUILD) $(SFLAGS) -c $< +$(TESTS): %: $(testdir)/%.c + $(BUILD) $(DEMOFLAGS) -o$@ $< $(LDFLAGS) + $(DEMOS_EXCEPT_TUIDEMO): %: $(demodir)/%.c $(BUILD) $(DEMOFLAGS) -o$@ $< $(LDFLAGS) diff --git a/sdl2/Makefile b/sdl2/Makefile index ccd01541..b84dc49d 100644 --- a/sdl2/Makefile +++ b/sdl2/Makefile @@ -127,20 +127,25 @@ LINK = $(CC) DEMOS += sdltest$(E) -.PHONY: all libs clean demos +.PHONY: all libs clean demos tests all: libs libs: $(LIBCURSES) clean: - -$(RM) *.o trace $(CLEAN) $(DEMOS) + -$(RM) *.o trace $(CLEAN) $(DEMOS) $(TESTS) demos: $(DEMOS) ifneq ($(DEBUG),Y) $(PREFIX)-strip $(DEMOS) endif +tests: $(TESTS) +ifneq ($(DEBUG),Y) + $(PREFIX)-strip $(TESTS) +endif + install: ifneq ($(OS),Windows_NT) cp lib$(DLLNAME).so /usr/local/lib @@ -162,6 +167,7 @@ pdcurses.o: $(common)/pdcurses.rc $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(PDCOBJS) : $(PDCURSES_SDL_H) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) +$(TESTS) : $(PDCURSES_CURSES_H) $(LIBCURSES) tui.o tuidemo.o : $(PDCURSES_CURSES_H) terminfo.o : $(TERM_HEADER) panel.o ptest$(E) test_pan$(E): $(PANEL_HEADER) @@ -172,6 +178,9 @@ $(LIBOBJS) : %.o: $(srcdir)/%.c $(PDCOBJS) : %.o: $(osdir)/%.c $(BUILD) $(SFLAGS) -c $< +$(TESTS): %: $(testdir)/%.c + $(BUILD) $(DEMOFLAGS) -o$@ $< $(LDFLAGS) + $(DEMOS_EXCEPT_TUIDEMO): %: $(demodir)/%.c $(BUILD) $(DEMOFLAGS) -o$@ $< $(LDFLAGS) diff --git a/vt/Makefile b/vt/Makefile index 65097e65..9ca1e27b 100644 --- a/vt/Makefile +++ b/vt/Makefile @@ -106,20 +106,25 @@ LINK = $(CC) LDFLAGS = $(LIBCURSES) RANLIB = $(PREFIX)ranlib -.PHONY: all libs clean demos +.PHONY: all libs clean demos tests all: libs libs: $(LIBCURSES) clean: - -$(RM) *.o trace $(LIBCURSES) $(DEMOS) + -$(RM) *.o trace $(LIBCURSES) $(DEMOS) $(TESTS) demos: libs $(DEMOS) ifneq ($(DEBUG),Y) $(STRIP) $(DEMOS) endif +tests: libs $(TESTS) +ifneq ($(DEBUG),Y) + $(STRIP) $(TESTS) +endif + $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) $(LIBEXE) $(LIBFLAGS) $@ $? ifeq ($(LIBCURSES),$(LIBNAME).a) @@ -128,6 +133,7 @@ endif $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) +$(TESTS) : $(PDCURSES_CURSES_H) $(LIBCURSES) tui.o tuidemo.o : $(PDCURSES_CURSES_H) terminfo.o : $(TERM_HEADER) panel.o ptest: $(PANEL_HEADER) @@ -141,6 +147,9 @@ $(PDCOBJS) : %.o: $(osdir)/%.c $(DEMOS_EXCEPT_TUIDEMO): %: $(demodir)/%.c $(BUILD) $(DEMOFLAGS) -o$@ $< $(LDFLAGS) +$(TESTS): %: $(testdir)/%.c + $(BUILD) $(DEMOFLAGS) -o$@ $< $(LDFLAGS) + tuidemo$(E) : tuidemo.o tui.o $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) diff --git a/wincon/Makefile b/wincon/Makefile index 20780333..3d374930 100644 --- a/wincon/Makefile +++ b/wincon/Makefile @@ -126,7 +126,7 @@ endif CLEAN = *.a endif -.PHONY: all libs clean demos dist +.PHONY: all libs clean demos dist tests all: libs @@ -143,6 +143,11 @@ ifneq ($(DEBUG),Y) $(STRIP) *.exe endif +tests: libs $(TESTS) +ifneq ($(DEBUG),Y) + $(STRIP) $(TESTS) +endif + $(LIBCURSES) : $(LIBDEPS) $(LIBEXE) $(LIBFLAGS) $@ $? $(LIBSADDED) $(CP) $(LIBNAME).a panel.a @@ -161,6 +166,9 @@ $(PDCOBJS) : %.o: $(osdir)/%.c $(DEMOS_EXCEPT_TUIDEMO): %.exe: $(demodir)/%.c $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES) $(EXELIBS) +$(TESTS): %.exe: $(testdir)/%.c + $(CC) $(CFLAGS) -mwindows -o$@ $< $(LIBCURSES) $(EXELIBS) + tuidemo.exe: tuidemo.o tui.o $(LINK) $(LDFLAGS) -o$@ tuidemo.o tui.o $(LIBCURSES) $(EXELIBS) diff --git a/wingui/Makefile b/wingui/Makefile index e1663dda..357b28a4 100644 --- a/wingui/Makefile +++ b/wingui/Makefile @@ -122,7 +122,7 @@ endif CLEAN = *.a endif -.PHONY: all libs clean demos dist +.PHONY: all libs clean demos dist tests all: libs @@ -139,6 +139,11 @@ ifneq ($(DEBUG),Y) $(STRIP) *.exe endif +tests: libs $(TESTS) +ifneq ($(DEBUG),Y) + $(STRIP) $(TESTS) +endif + $(LIBCURSES) : $(LIBDEPS) $(LIBEXE) $(LIBFLAGS) $@ $? $(LIBSADDED) $(CP) $(LIBNAME).a panel.a @@ -157,6 +162,9 @@ $(PDCOBJS) : %.o: $(osdir)/%.c $(DEMOS_EXCEPT_TUIDEMO): %.exe: $(demodir)/%.c $(CC) $(CFLAGS) -mwindows -o$@ $< $(LIBCURSES) $(EXELIBS) +$(TESTS): %.exe: $(testdir)/%.c + $(CC) $(CFLAGS) -mwindows -o$@ $< $(LIBCURSES) $(EXELIBS) + tuidemo.exe: tuidemo.o tui.o $(LINK) $(LDFLAGS) -mwindows -o$@ tuidemo.o tui.o $(LIBCURSES) $(EXELIBS)