Cleanup, output basic XML
[jelmer/ptabtools.git] / Makefile
1 prefix = /usr/local
2 bindir = $(prefix)/bin
3 mandir = $(prefix)/share/man
4 libdir = $(prefix)/lib
5 includedir = $(prefix)/include
6 pkgconfigdir = $(libdir)/pkgconfig
7 PTB_VERSION=0.2
8 PROGS = ptb2ly libptb-$(PTB_VERSION).so ptb2ascii
9 INSTALL = install
10 CFLAGS = -g -Wall -DPTB_VERSION=\"$(PTB_VERSION)\" 
11
12 PTB2LY_OBJS = ptb2ly.o ptb.o
13 PTB2ASCII_OBJS = ptb2ascii.o ptb.o
14 PTB2MUSICXML_OBJS = ptb2musicxml.o ptb.o
15 PTBSO_OBJS = ptb.o
16
17 all: $(PROGS)
18         pkg-config --exists libxml-2.0 && $(MAKE) ptb2musicxml
19
20 ptb2musicxml.o: ptb2musicxml.c
21         $(CC) $(CFLAGS) -c $< `pkg-config --cflags glib-2.0 libxml-2.0`
22
23 %.o: %.c
24         $(CC) $(CFLAGS) -c $< `pkg-config --cflags glib-2.0`
25
26 libptb-$(PTB_VERSION).so: $(PTBSO_OBJS)
27         $(CC) -shared $(CFLAGS) -o $@ $(PTBSO_OBJS) `pkg-config --libs glib-2.0`
28         
29 ptb2musicxml: $(PTB2MUSICXML_OBJS)
30         $(CC) $(CFLAGS) -o $@ $? `pkg-config --libs glib-2.0 libxml-2.0` -lpopt
31
32 ptb2ascii: $(PTB2ASCII_OBJS)
33         $(CC) $(CFLAGS) -o $@ $? `pkg-config --libs glib-2.0` -lpopt
34
35 ptb2ly: $(PTB2LY_OBJS)
36         $(CC) $(CFLAGS) -o $@ $? `pkg-config --libs glib-2.0` -lpopt
37
38 install: all
39         $(INSTALL) ptb2ly $(DESTDIR)$(bindir)
40         $(INSTALL) ptb2ascii $(DESTDIR)$(bindir)
41         $(INSTALL) -m 644 ptb2ly.1 $(DESTDIR)$(mandir)/man1
42         $(INSTALL) -m 644 ptb2ascii.1 $(DESTDIR)$(mandir)/man1
43         $(INSTALL) libptb-$(PTB_VERSION).so $(DESTDIR)$(libdir)
44         $(INSTALL) -m 644 ptb.h $(DESTDIR)$(includedir)
45         $(INSTALL) -m 644 ptabtools.pc $(DESTDIR)$(pkgconfigdir)
46
47 tags:
48         ctags *.c *.h
49
50 clean: 
51         rm -f *.o core $(PROGS)