Tweaked CFLAGS detection in config.sh.
[ahxm.git] / makefile.in
blob0edb13ebfb73858c08640fc51971d962c5555e11
1 # -*- Mode: sh
3 PROJ=ahxm
4 APPNAME=ahxm
5 LIB=lib$(PROJ).a
7 OBJS=support.o sha1.o song.o compiler_l.o compiler_y.o \
8 ss_core.o ss_input.o ss_gen.o ss_eff.o ss_ins.o ss_song.o \
9 ss_output.o ss_outdev.o midi_song.o main.o
11 ADD_DOCS=RELEASE_NOTES TODO README
12 GRUTATXT_DOCS=doc/ahs_overview_i.html \
13 doc/ahs_overview_ii.html \
14 doc/ahs_appendix_1.html \
15 doc/ahxm_index.html
16 MP_DOCCER_DOCS=doc/ahxm_api.txt
17 G_AND_MP_DOCS=doc/ahxm_api.html
19 all: $(BIN) $(DOCS)
21 DIST_TARGET=/tmp/$(PROJ)-$(VERSION)
23 ##################################################################
25 version:
26 @echo $(VERSION)
28 .c.o:
29 $(CC) $(CFLAGS) `cat config.cflags` -c $<
31 y.tab.h: compiler.y
32 $(YACC) -d compiler.y
34 y.tab.c: compiler.y
35 $(YACC) -d compiler.y
37 lex.yy.c: compiler.l
38 flex compiler.l
40 compiler_l.o: lex.yy.c y.tab.h
41 $(CC) $(CFLAGS) -c lex.yy.c -o compiler_l.o
43 compiler_y.o: y.tab.c
44 $(CC) $(CFLAGS) -c y.tab.c -o compiler_y.o
46 # library
47 $(LIB): $(OBJS)
48 $(AR) rv $(LIB) $(OBJS)
50 # binaries
51 ahxm: $(LIB)
52 $(CC) $(CFLAGS) $(LIB) -lm `cat config.ldflags` -o $@
54 wav: wav.c $(LIB)
55 $(CC) $(CFLAGS) wav.c $(LIB) -lm `cat config.ldflags` -o $@
57 midiin: midiin.c $(LIB)
58 $(CC) $(CFLAGS) midiin.c $(LIB) -lm `cat config.ldflags` -o $@
60 clean:
61 rm -f $(BIN) $(LIB) $(OBJS) *.o tags *.tar.gz
63 realclean: clean
64 rm -f y.tab.c y.tab.h lex.yy.c
66 distclean: realclean
67 rm -f config.h config.cflags config.ldflags makefile.opts .config.log Makefile
69 .SUFFIXES: .txt .html
71 .txt.html:
72 grutatxt < $< > $@
74 doc/ahxm_api.txt: *.c
75 mp_doccer *.c -o doc/ahxm_api -f grutatxt \
76 -t "Ann Hell Ex Machina API" \
77 -b "This document references version $(VERSION) of the C API." \
78 -a 'Angel Ortega - angel@triptico.com'
80 docsclean:
81 rm -f $(MP_DOCCER_DOCS) doc/*.html
83 distcopy: distclean y.tab.c y.tab.h lex.yy.c
84 mkdir -p $(DIST_TARGET) ; \
85 tar cf - * | (cd $(DIST_TARGET) ; tar xf -)
87 dist: distcopy
88 (cd /tmp ; tar czf - $(PROJ)-$(VERSION)/* ) > $(PROJ)-$(VERSION).tar.gz ; \
89 rm -rf $(DIST_TARGET)
91 dep:
92 gcc -MM *.c > makefile.depend
94 install:
95 install $(APPNAME) $(PREFIX)/bin
96 ./mkinstalldirs $(PREFIX)/share/doc/$(PROJ)
97 install -m 644 doc/* $(PREFIX)/share/doc/$(PROJ)
98 install -m 644 $(ADD_DOCS) $(PREFIX)/share/doc/$(PROJ)
100 test:
101 ./test.sh
103 stress: stress.c $(LIB)
104 $(CC) stress.c $(CFLAGS) $(LIB) -lm `cat config.ldflags` -o $@
106 win32dist: ahxm.exe
107 zip ahxm-$(VERSION).zip ahxm.exe $(ADD_DOCS) doc/*.* examples/*.* samples/*.*