Cleanup the Makefile

This commit is contained in:
Devin Torres 2013-09-21 04:57:13 -05:00
parent bdefe91629
commit bcfd0a2d96

View file

@ -1,13 +1,5 @@
# Makefile CFLAGS = -c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc
LDFLAGS = -g -O3 -Wall -Werror
DEPDIR=depends
# "Machine-dependant" options
#MFLAGS=-fPIC
CFLAGS=-c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc
LDFLAGS=-g -O3 -Wall -Werror
HOEDOWN_SRC=\ HOEDOWN_SRC=\
src/autolink.o \ src/autolink.o \
@ -19,13 +11,13 @@ HOEDOWN_SRC=\
src/markdown.o \ src/markdown.o \
src/stack.o src/stack.o
all: libhoedown.so hoedown smartypants html_blocks .PHONY: all test clean
.PHONY: all html_blocks test clean all: libhoedown.so hoedown smartypants
# libraries # libraries
libhoedown.so: libhoedown.so.1 libhoedown.so: libhoedown.so.1
ln -f -s $^ $@ ln -f -s $^ $@
libhoedown.so.1: $(HOEDOWN_SRC) libhoedown.so.1: $(HOEDOWN_SRC)
@ -33,7 +25,7 @@ libhoedown.so.1: $(HOEDOWN_SRC)
# executables # executables
hoedown: examples/hoedown.o $(HOEDOWN_SRC) hoedown: examples/hoedown.o $(HOEDOWN_SRC)
$(CC) $(LDFLAGS) $^ -o $@ $(CC) $(LDFLAGS) $^ -o $@
smartypants: examples/smartypants.o $(HOEDOWN_SRC) smartypants: examples/smartypants.o $(HOEDOWN_SRC)
@ -44,27 +36,20 @@ smartypants: examples/smartypants.o $(HOEDOWN_SRC)
src/html_blocks.c: html_block_names.gperf src/html_blocks.c: html_block_names.gperf
gperf -L ANSI-C -N hoedown_find_block_tag -c -C -E -S 1 --ignore-case -m100 $^ > $@ gperf -L ANSI-C -N hoedown_find_block_tag -c -C -E -S 1 --ignore-case -m100 $^ > $@
# testing
test: hoedown test: hoedown
perl test/MarkdownTest_1.0.3/MarkdownTest.pl \ perl test/MarkdownTest_1.0.3/MarkdownTest.pl \
--script=./hoedown --testdir=test/MarkdownTest_1.0.3/Tests --tidy --script=./hoedown --testdir=test/MarkdownTest_1.0.3/Tests --tidy
# housekeeping # housekeeping
clean: clean:
rm -f src/*.o examples/*.o $(RM) -f src/*.o examples/*.o
rm -f libhoedown.so libhoedown.so.1 hoedown smartypants $(RM) -f libhoedown.so libhoedown.so.1 hoedown smartypants
rm -f hoedown.exe smartypants.exe $(RM) -f hoedown.exe smartypants.exe
rm -rf $(DEPDIR)
# dependencies
include $(wildcard $(DEPDIR)/*.d)
# generic object compilations # generic object compilations
%.o: src/%.c examples/%.c %.o: src/%.c examples/%.c
@mkdir -p $(DEPDIR)
@$(CC) -MM $< > $(DEPDIR)/$*.d
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $<