Fix compatibility with newer versions of lilypond.
[jelmer/ptabtools.git] / Makefile
index 9c4cbdd6ff2d49f09951dd2b97c99fb3df2922ae..244e87bac6ae2dc10dddc6c5f1b7ee4387fec0c5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,54 +1,64 @@
 -include Makefile.settings
 
-PTBSO_OBJS = ptb.o gp.o
+SOVERSION = 0
 
-all: $(PROGS)
+PTBLIB_OBJS = ptb.o gp.o ptb-tuning.o
+TARGETS = $(TARGET_BINS) $(TARGET_LIBS)
+
+all: $(TARGETS)
+
+tests/check: tests/check.o tests/ptb.o tests/gp.o ptb.o
+       $(CC) $(FLAGS) $^ -o $@ $(CHECK_LIBS) 
 
 ptb2xml.o: ptb2xml.c
        $(CC) $(CFLAGS) -c $< $(LIBXSLT_CFLAGS) $(LIBXML_CFLAGS) $(XSLT_DEFINE)
 
 %.o: %.c
-       $(CC) $(CFLAGS) -c $< 
-
-ptb.dll: $(PTBSO_OBJS)
-       $(CC) -shared $(CFLAGS) -o $@ $^ 
+       $(CC) $(CFLAGS) -c $< -o $@
 
-ptb.lib: $(PTBSO_OBJS)
-       $(DLLTOOL) -l $@ $(PTBSO_OBJS)
+%.po: %.c
+       $(CC) $(CFLAGS) -fPIC -c $< -o $@
 
-ptb.def: $(PTBSO_OBJS)
-       $(DLLTOOL) -e $@ $(PTBSO_OBJS)
+ptb.dll: $(PTBLIB_OBJS)
+       $(CC) $(SHFLAGS) $(CFLAGS) -Wl,--out-implib=ptb.dll.a -o $@ $^
 
-libptb.so.$(VERSION): $(PTBSO_OBJS)
-       $(CC) -shared $(CFLAGS) -o $@ $^
+libptb.so.$(VERSION): $(PTBLIB_OBJS:.o=.po)
+       $(CC) $(SHFLAGS) -Wl,-soname,libptb.so.$(SOVERSION) $(CFLAGS) -o $@ $^
 
-libptb.a: $(PTBSO_OBJS)
+libptb.a: $(PTBLIB_OBJS)
        $(AR) rs $@ $^
 
 ptb2xml$(EXEEXT): ptb2xml.o ptb.o
-       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(LIBXML_LIBS) $(LIBXSLT_LIBS)
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(LIBXML_LIBS) $(LIBXSLT_LIBS) $(POPT_LIBS)
        
 ptb2ascii$(EXEEXT): ptb2ascii.o ptb.o
-       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
 
 ptb2ptb$(EXEEXT): ptb2ptb.o ptb.o
-       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
 
 ptb2ly$(EXEEXT): ptb2ly.o ptb.o
-       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
+
+ptb2abc$(EXEEXT): ptb2abc.o ptb.o
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
 
 gp2ly$(EXEEXT): gp2ly.o gp.o
-       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
 
 ptbinfo$(EXEEXT): ptbinfo.o ptb.o
-       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
 
+ptbdict$(EXEEXT): ptbdict.o ptb.o ptb-tuning.o
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
+       
 install: all
-       $(INSTALL) $(PROGS) $(DESTDIR)$(bindir)
+       $(INSTALL) -d $(DESTDIR)$(bindir)
+       test -z "$(TARGET_BINS)" || $(INSTALL) $(TARGET_BINS) $(DESTDIR)$(bindir)
        $(INSTALL) -d $(DESTDIR)$(mandir)/man1
        $(INSTALL) -m 644 $(PROGS_MANPAGES) $(DESTDIR)$(mandir)/man1
        $(INSTALL) -d $(DESTDIR)$(libdir)
-       $(INSTALL) -m 644 $(LIBS) $(DESTDIR)$(libdir)
+       test -z "$(TARGET_LIBS)" || $(INSTALL) -m 644 $(TARGET_LIBS) $(DESTDIR)$(libdir)
        $(INSTALL) -d $(DESTDIR)$(includedir)
        $(INSTALL) -m 644 ptb.h $(DESTDIR)$(includedir)
        $(INSTALL) -m 644 gp.h $(DESTDIR)$(includedir)
@@ -56,13 +66,38 @@ install: all
        $(INSTALL) -m 644 ptabtools.pc $(DESTDIR)$(pkgconfigdir)
        $(INSTALL) -d $(DESTDIR)$(datadir)
        $(INSTALL) -m 644 ptbxml2musicxml.xsl $(DESTDIR)$(datadir)
+       $(INSTALL) -m 644 ptbxml.dtd $(DESTDIR)$(datadir)
 
-test:
-       $(MAKE) -C test
+test: all ptb2ptb
+       $(MAKE) -C tests
 
-ctags: tags
-tags: *.c *.h
+tags: $(wildcard *.c) $(wildcard *.h)
        ctags *.c *.h
 
+check:: tests/check
+       ./tests/check
+
+configure: configure.in
+       autoreconf -f
+
+config.status: configure
+       ./configure
+
+Makefile.settings: config.status
+       ./config.status
+
 clean: 
-       rm -f *.o core $(PROGS) $(LIBS)
+       rm -f *.o core $(TARGETS) *.po
+       rm -f tests/check tests/*.o
+
+distclean: clean
+       rm -f Makefile.settings config.h config.log
+       rm -f *~ ptabtools.spec ptabtools.pc
+       rm -f tags config.status aclocal.m4
+       rm -rf autom4te.cache/ 
+
+realclean: distclean
+       rm -f configure
+
+ctags:
+       ctags -R .