include config.mk

all: gumbo.a

gumbo.a: attribute.o char_ref.o char_ref_gperf.o error.o parser.o
gumbo.a: string_buffer.o string_piece.o tag.o tokenizer.o utf8.o
gumbo.a: util.o vector.o
	ar rcs gumbo.a *.o

install: gumbo.a
	cp gumbo.h $(PREFIX)/include
	cp tag_enum.h $(PREFIX)/include
	cp gumbo.a $(PREFIX)/lib/libgumbo.a

clean:
	rm -f *.o gumbo.a

attribute.o: attribute.c attribute.h util.h
	$(CC) -c attribute.c -o attribute.o

char_ref.o: char_ref.c char_ref.h error.h string_piece.h utf8.h util.h 
	$(CC) -c char_ref.c -o char_ref.o

char_ref_gperf.o: char_ref_gperf.c char_ref.h
	$(CC) -c char_ref_gperf.c -o char_ref_gperf.o

error.o: error.c error.h gumbo.h parser.h string_buffer.h util.h vector.h
	$(CC) -c error.c -o error.o

parser.o: parser.c parser.h attribute.h error.h gumbo.h insertion_mode.h
parser.o: tokenizer.h tokenizer_states.h utf8.h util.h vector.h
	$(CC) -c parser.c -o parser.o

string_buffer.o: string_buffer.c string_buffer.h util.h
	$(CC) -c string_buffer.c -o string_buffer.o

string_piece.o: string_piece.c string_piece.h util.h
	$(CC) -c string_piece.c -o string_piece.o

tag.o: tag.c gumbo.h
	$(CC) -c tag.c -o tag.o

tokenizer.o: tokenizer.c tokenizer.h attribute.h char_ref.h error.h
tokenizer.o: gumbo.h parser.h string_buffer.h string_piece.h token_type.h
tokenizer.o: tokenizer_states.h utf8.h util.h vector.h
	$(CC) -c tokenizer.c -o tokenizer.o

utf8.o: utf8.c utf8.h error.h gumbo.h parser.h util.h vector.h
	$(CC) -c utf8.c -o utf8.o

util.o: util.c util.h gumbo.h parser.h
	$(CC) -c util.c -o util.o

vector.o: vector.c vector.h util.h
	$(CC) -c vector.c -o vector.o
