Makefile 2.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# Copyright (C) 2004-2013 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of proinfodata
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
20

21
BUILD = build
22

23
SRCDIR = src
24

25 26 27
CC = gcc
CFLAGS = -m32 -static -Wall -I$(SRCDIR) -I$(BUILD)/include
LDFLAGS = -m32 -static -pthread
28

29 30 31 32
LIBXMLVER = 2.7
LIBXMLREL = 8
LIBXMLURL = ftp://xmlsoft.org/libxml2/libxml2-$(LIBXMLVER).$(LIBXMLREL).tar.gz
LIBXML = libxml2-$(LIBXMLVER).$(LIBXMLREL)
33

34 35
.PHONY: all
all: bin/collect-parser
36

37
.PHONY: clean
38
clean:
39 40
	@rm -rf $(BUILD)
	@rm -rf bin/collect-parser
41

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

###########
# libxml2 #
###########

$(BUILD)/$(LIBXML).tar.gz:
	@mkdir -p $(BUILD)
	wget -O $@ $(LIBXMLURL)

$(BUILD)/$(LIBXML)/.extracted: $(BUILD)/$(LIBXML).tar.gz
	cd $(BUILD); tar xzvf $(LIBXML).tar.gz
	touch $@

$(BUILD)/$(LIBXML)/Makefile: $(BUILD)/$(LIBXML)/.extracted
	cd $(BUILD)/$(LIBXML); \
	./configure --with-minimum --with-writer --with-tree --prefix=$(realpath $(BUILD)) CFLAGS="-m32 -static"

$(BUILD)/lib/libxml2.a: $(BUILD)/$(LIBXML)/Makefile
	cd $(BUILD)/$(LIBXML); \
	make; \
	make install


##################
# collect-parser #
##################

$(BUILD)/collect-parser.o: $(SRCDIR)/collect-parser.c $(BUILD)/lib/libxml2.a
	$(CC) -o $@ -I$(BUILD)/include/libxml2 $(CFLAGS) -c $<

bin/collect-parser: $(BUILD)/collect-parser.o $(BUILD)/lib/libxml2.a
	@mkdir -p bin
	$(CC) -o $@ $(LDFLAGS) $^