| 1 |
|
| 2 |
|
| 3 |
O = o |
| 4 |
|
| 5 |
ifndef PDCURSES_SRCDIR |
| 6 |
PDCURSES_SRCDIR = .. |
| 7 |
endif |
| 8 |
|
| 9 |
include $(PDCURSES_SRCDIR)/libobjs.mif |
| 10 |
|
| 11 |
osdir = $(PDCURSES_SRCDIR)/sdl1 |
| 12 |
|
| 13 |
PDCURSES_SDL_H = $(osdir)/pdcsdl.h |
| 14 |
|
| 15 |
SFLAGS = $(shell sdl-config --cflags) |
| 16 |
SLIBS = $(shell sdl-config --libs) |
| 17 |
|
| 18 |
|
| 19 |
SFLAGS += -DHAVE_VSNPRINTF -DHAVE_VSSCANF |
| 20 |
|
| 21 |
ifeq ($(DEBUG),Y) |
| 22 |
CFLAGS = -g -Wall -DPDCDEBUG |
| 23 |
else |
| 24 |
CFLAGS = -O2 -Wall |
| 25 |
endif |
| 26 |
|
| 27 |
BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) |
| 28 |
|
| 29 |
ifeq ($(shell uname),Darwin) |
| 30 |
DEMOFLAGS = -Dmain=SDL_main |
| 31 |
endif |
| 32 |
|
| 33 |
LINK = $(CC) |
| 34 |
LDFLAGS = $(LIBCURSES) $(SLIBS) |
| 35 |
RANLIB = ranlib |
| 36 |
LIBCURSES = libpdcurses.a |
| 37 |
|
| 38 |
DEMOS = firework newdemo ptest rain testcurs tuidemo worm xmas \ |
| 39 |
sdltest |
| 40 |
|
| 41 |
.PHONY: all libs clean demos |
| 42 |
|
| 43 |
all: libs demos |
| 44 |
|
| 45 |
libs: $(LIBCURSES) |
| 46 |
|
| 47 |
clean: |
| 48 |
-rm -rf *.o trace $(LIBCURSES) $(DEMOS) |
| 49 |
|
| 50 |
demos: $(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) |
| 60 |
tui.o tuidemo.o : $(PDCURSES_CURSES_H) |
| 61 |
terminfo.o: $(TERM_HEADER) |
| 62 |
panel.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 |
|
| 70 |
firework: $(demodir)/firework.c |
| 71 |
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) |
| 72 |
|
| 73 |
newdemo: $(demodir)/newdemo.c |
| 74 |
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) |
| 75 |
|
| 76 |
ptest: $(demodir)/ptest.c |
| 77 |
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) |
| 78 |
|
| 79 |
rain: $(demodir)/rain.c |
| 80 |
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) |
| 81 |
|
| 82 |
testcurs: $(demodir)/testcurs.c |
| 83 |
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) |
| 84 |
|
| 85 |
tuidemo: tuidemo.o tui.o |
| 86 |
$(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) |
| 87 |
|
| 88 |
worm: $(demodir)/worm.c |
| 89 |
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) |
| 90 |
|
| 91 |
xmas: $(demodir)/xmas.c |
| 92 |
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) |
| 93 |
|
| 94 |
sdltest: $(osdir)/sdltest.c |
| 95 |
$(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) |
| 96 |
|
| 97 |
tui.o: $(demodir)/tui.c $(demodir)/tui.h |
| 98 |
$(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c |
| 99 |
|
| 100 |
tuidemo.o: $(demodir)/tuidemo.c |
| 101 |
$(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c |