1# makefile for aylet
2
3# You need an ANSI C compiler. gcc is probably best.
4#
5CC?=gcc
6
7# Compiler options (and sound driver) to use. This one is for Linux,
8# and other OSS-using systems.
9#
10CFLAGS+=-Wall -DDRIVER_OSS
11
12# for OpenBSD, uncomment this:
13#CFLAGS=-O -Wall -DDRIVER_OPENBSD
14
15# Set how to link the curses lib - this is for Linux.
16# (Most non-Linux systems will probably want `-lcurses' instead.)
17#
18CURSES_LIB=-lncurses
19
20# dest for make install
21#
22PREFIX?=/usr/local
23BINDIR=$(DESTDIR)$(PREFIX)/bin
24XBINDIR=$(BINDIR)
25MANDIR=$(DESTDIR)$(PREFIX)/man/man1
26
27# if you want the X version to be installed in the usual X executables
28# directory, uncomment this (altering if necessary):
29#
30#XBINDIR=/usr/X11R6/bin
31
32
33# you shouldn't need to edit the rest
34#-----------------------------------------------------------------
35
36# this looks wrong, but *ops.c are actually #include'd by z80.c
37OBJS=main.o sound.o ui.o z80.o drv-oss.o drv-obsd.o
38XOBJS=main.o sound.o uigtk.o z80.o drv-oss.o drv-obsd.o
39
40GTK_CFLAGS+=        `pkg-config --cflags gtk+-2.0` -DGTK2
41GTK_LDFLAGS+=       `pkg-config --libs gtk+-2.0` -DGTK2
42
43all: aylet xaylet
44
45aylet: $(OBJS)
46	$(CC) $(LDFLAGS) $(CFLAGS) -o aylet $(OBJS) $(CURSES_LIB)
47
48xaylet: $(XOBJS)
49	$(CC) $(GTK_CFLAGS) $(GTK_LDFLAGS) $(LDFLAGS) $(CFLAGS) -o xaylet $(XOBJS)
50
51uigtk.o: uigtk.c
52	$(CC) $(GTK_CFLAGS) $(CFLAGS) $(LDFLAGS) -c uigtk.c -o uigtk.o
53
54installdirs:
55	/bin/sh ./mkinstalldirs $(BINDIR) $(XBINDIR) $(MANDIR)
56
57install: installdirs
58	if [ -f aylet ]; then strip aylet; install -m 755 aylet $(BINDIR); fi
59	if [ -f xaylet ]; then strip xaylet; install -m 755 xaylet $(XBINDIR); fi
60	install -m 644 aylet.1 $(MANDIR)
61
62uninstall:
63	$(RM) $(BINDIR)/aylet $(XBINDIR)/xaylet
64	$(RM) $(MANDIR)/aylet.1* $(MANDIR)/xaylet.1*
65
66clean:
67	$(RM) *.o *~ aylet xaylet
68
69# dependencies
70cbops.o: cbops.c
71drv-obsd.o: drv-obsd.c
72drv-oss.o: drv-oss.c
73edops.o: edops.c
74main.o: main.c main.h sound.h ui.h z80.h
75sound.o: sound.c main.h z80.h sound.h driver.h
76ui.o: ui.c main.h ui.h
77uigtk.o: uigtk.c main.h ui.h button1.xpm button2.xpm button3.xpm \
78 button4.xpm button5.xpm
79z80.o: z80.c main.h z80.h z80ops.c cbops.c edops.c
80z80ops.o: z80ops.c cbops.c edops.c
81
82
83VERS=0.5
84
85tgz: ../aylet-$(VERS).tar.gz
86
87../aylet-$(VERS).tar.gz: clean
88	$(RM) ../aylet-$(VERS)
89	@cd ..;ln -s aylet aylet-$(VERS)
90	cd ..;tar zchvf aylet-$(VERS).tar.gz aylet-$(VERS)
91	@cd ..;$(RM) aylet-$(VERS)
92