Commit d482f7bb authored by Eduardo L. Buratti's avatar Eduardo L. Buratti

build: Rebuild collect compiling steps

Signed-off-by: Eduardo L. Buratti's avatarEduardo L. Buratti <elb09@c3sl.ufpr.br>
parent 2cf403ac
......@@ -34,6 +34,7 @@ all: $(BASE)/client/bin/client
clean:
@rm -rf $(BUILD)
cd $(BASE)/client; make clean
cd $(BASE)/collect; make clean
#######################
......@@ -64,5 +65,10 @@ $(BUILD)/$(WGET)/src/wget: $(BUILD)/$(WGET)/Makefile
# BUILD AGENT
#######################
# client
$(BASE)/client/bin/client: $(BUILD)/$(WGET)/src/wget $(BASE)/client/Makefile
cd $(BASE)/client; make
# collect
$(BASE)/collect/bin/collect-parser: $(BASE)/collect/Makefile
cd $(BASE)/collect; make
# 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.
TOPDIR = .
SRCDIR = $(TOPDIR)/src
BUILD = build
LIBDIR = $(TOPDIR)/lib
BINDIR = bin
LIBXMLDIR = lib
SRCDIR = src
all:
cd $(LIBDIR) && make all
cd $(SRCDIR) && make all
CC = gcc
CFLAGS = -m32 -static -Wall -I$(SRCDIR) -I$(BUILD)/include
LDFLAGS = -m32 -static -pthread
collect-parser:
cd $(SRCDIR) && make all
LIBXMLVER = 2.7
LIBXMLREL = 8
LIBXMLURL = ftp://xmlsoft.org/libxml2/libxml2-$(LIBXMLVER).$(LIBXMLREL).tar.gz
LIBXML = libxml2-$(LIBXMLVER).$(LIBXMLREL)
install: all
@cd $(LIBDIR) && make install
@cd $(SRCDIR) && make install
@echo "Setting variables in agent.conf..."
@grep -v "XMLPARSER=" agent.conf > temp.conf\
&& cat temp.conf > agent.conf && rm -f temp.conf
@echo XMLPARSER=$$\{PREFIX\}/$(BINDIR)/collect-parser >> agent.conf
.PHONY: all
all: bin/collect-parser
.PHONY: clean
clean:
cd $(LIBDIR) && make clean
cd $(SRCDIR) && make clean
@rm -rf $(BUILD)
@rm -rf bin/collect-parser
distclean:
cd $(LIBDIR) && make distclean
cd $(SRCDIR) && make distclean
###########
# 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) $^
LIBDIR = .
LIBXMLVER = 2.7.8
LIBXMLDIR = libxml2-$(LIBXMLVER)
LIBXML = libxml2
LIBINSTDIR = $(PWD)/lib
LIBINSTINC = $(PWD)/include
all: xml
xml:
@test -f "$(PWD)/$(LIBXML)-$(LIBXMLVER).tar.gz" ||\
wget ftp://xmlsoft.org/libxml2/$(LIBXMLDIR).tar.gz
@if ! test -d "$(LIBDIR)/$(LIBXMLDIR)"; then\
tar xzf $(LIBXML)-$(LIBXMLVER).tar.gz;\
cd $(LIBDIR)/$(LIBXMLDIR);\
./configure --with-minimum --with-writer --with-tree --prefix=$(PWD)/$(LIBXML) CFLAGS="-m32 -static" && make all && make install;\
fi
install: all
@if ! test -d "$(LIBINSTDIR)"; then\
mv $(PWD)/$(LIBXML)/include $(PWD)/;\
mkdir $(LIBINSTDIR);\
mv $(PWD)/$(LIBXML)/lib/$(LIBXML).a $(LIBINSTDIR);\
rm -r $(PWD)/$(LIBXML)-$(LIBXMLVER).tar.gz $(PWD)/$(LIBXML)\
$(PWD)/$(LIBXMLDIR);\
fi
clean:
@find $(PWD) -type f \( -name '*~' -o -name '*.bak' -o -name 'core*' \)\
-exec rm -f {} \;
distclean:
@rm -rf $(LIBXML) $(LIBXMLDIR) $(LIBINSTDIR) $(LIBINSTINC)
@find $(PWD) -type f \( -name '*~' -o -name '*.bak' -o -name 'core*' \)\
-exec rm -f {} \;
@rm -f *.tar.gz
CC= gcc
TOPDIR = ..
LIBXML := $(shell test -d "$(TOPDIR)/lib/libxml2" && echo libxml2)
BINDIR = $(TOPDIR)/bin
LIBDIR = $(TOPDIR)/lib
XMLDIR = $(LIBDIR)/$(LIBXML)
INCXMLDIR = $(XMLDIR)/include
LIBXMLDIR = $(XMLDIR)/lib
RELNANO = 1.1
CCFLAGS = -m32 -static -g -Wall -I$(INCXMLDIR)/libxml2 -pthread -L$(LIBXMLDIR) -lxml2
OBJ = collect-parser.o
BIN = collect-parser
all: $(OBJ)
$(CC) $(CCFLAGS) $(OBJ) $(LIBXMLDIR)/libxml2.a -o $(PWD)/$(BIN)
install: all
@mkdir -p $(BINDIR)
@mv -f $(PWD)/$(BIN) $(BINDIR)/$(BIN)
collect-parser.o: collect-parser.c
$(CC) $(CCFLAGS) -c collect-parser.c
clean:
@find $(PWD) -type f \( -name '*~' -o -name '*.bak' -o -name 'core*' \)\
-exec rm -f {} \;
distclean:
@find $(PWD) -type f \( -name '*.o' -o -name '*~' -o -name '*.bak' -o\
-name 'core*' \) -exec rm -f {} \;
@rm -f $(PWD)/$(BIN) $(BINDIR)/$(BIN)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment