1# Makefile for PDCurses library for SDL 2 3O = o 4 5ifndef PDCURSES_SRCDIR 6 PDCURSES_SRCDIR = .. 7endif 8 9include $(PDCURSES_SRCDIR)/libobjs.mif 10 11osdir = $(PDCURSES_SRCDIR)/sdl1 12 13PDCURSES_SDL_H = $(osdir)/pdcsdl.h 14 15SFLAGS = $(shell sdl-config --cflags) 16SLIBS = $(shell sdl-config --libs) 17 18# If your system doesn't have these, remove the defines here 19SFLAGS += -DHAVE_VSNPRINTF -DHAVE_VSSCANF 20 21ifeq ($(DEBUG),Y) 22 CFLAGS = -g -Wall -DPDCDEBUG 23else 24 CFLAGS = -O2 -Wall 25endif 26 27BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) 28 29ifeq ($(shell uname),Darwin) 30 DEMOFLAGS = -Dmain=SDL_main 31endif 32 33LINK = $(CC) 34LDFLAGS = $(LIBCURSES) $(SLIBS) 35RANLIB = ranlib 36LIBCURSES = libpdcurses.a 37 38DEMOS = firework newdemo ptest rain testcurs tuidemo worm xmas \ 39sdltest 40 41.PHONY: all libs clean demos 42 43all: libs demos 44 45libs: $(LIBCURSES) 46 47clean: 48 -rm -rf *.o trace $(LIBCURSES) $(DEMOS) 49 50demos: $(DEMOS) 51 strip $(DEMOS) 52 53$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) 54 ar rv $@ $? 55 -$(RANLIB) $@ 56 57$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) 58$(PDCOBJS) : $(PDCURSES_SDL_H) 59$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) 60tui.o tuidemo.o : $(PDCURSES_CURSES_H) 61terminfo.o: $(TERM_HEADER) 62panel.o ptest: $(PANEL_HEADER) 63 64$(LIBOBJS) : %.o: $(srcdir)/%.c 65 $(BUILD) $(SFLAGS) -c $< 66 67$(PDCOBJS) : %.o: $(osdir)/%.c 68 $(BUILD) $(SFLAGS) -c $< 69 70firework: $(demodir)/firework.c 71 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 72 73newdemo: $(demodir)/newdemo.c 74 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 75 76ptest: $(demodir)/ptest.c 77 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 78 79rain: $(demodir)/rain.c 80 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 81 82testcurs: $(demodir)/testcurs.c 83 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 84 85tuidemo: tuidemo.o tui.o 86 $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) 87 88worm: $(demodir)/worm.c 89 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 90 91xmas: $(demodir)/xmas.c 92 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 93 94sdltest: $(osdir)/sdltest.c 95 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 96 97tui.o: $(demodir)/tui.c $(demodir)/tui.h 98 $(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c 99 100tuidemo.o: $(demodir)/tuidemo.c 101 $(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c 102