added distrib infrastructure
git-svn-id: svn://anubis/fart/trunk@220 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
08429c5e58
commit
0e818d1a92
4
Makefile
4
Makefile
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
SHELL := bash
|
||||||
|
|
||||||
TARGET := fart
|
TARGET := fart
|
||||||
ifdef WIN32
|
ifdef WIN32
|
||||||
export CPPFLAGS += -I"$(shell cd)"
|
export CPPFLAGS += -I"$(shell cd)"
|
||||||
@ -9,7 +11,7 @@ export CXXFLAGS := -Wall -O2
|
|||||||
|
|
||||||
LDFLAGS := -lfl
|
LDFLAGS := -lfl
|
||||||
|
|
||||||
SUBDIRS := util shapes main parser
|
SUBDIRS := util shapes main parser distrib
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
23
distrib/Makefile
Normal file
23
distrib/Makefile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
|
||||||
|
DEPS := $(OBJS:.o=.dep)
|
||||||
|
|
||||||
|
all: $(DEPS) $(OBJS)
|
||||||
|
|
||||||
|
%.o: %.cc
|
||||||
|
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
|
||||||
|
|
||||||
|
# Make dependency files
|
||||||
|
%.dep: %.cc
|
||||||
|
@set -e; rm -f $@; \
|
||||||
|
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
|
||||||
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||||
|
rm -f $@.$$$$
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-$(RM) -f *.o *.dep
|
||||||
|
|
||||||
|
# Include dependency files
|
||||||
|
ifndef CLEAN
|
||||||
|
-include $(DEPS)
|
||||||
|
endif
|
23
distrib/distrib.cc
Normal file
23
distrib/distrib.cc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
#include "distrib.h"
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int distrib::readHostFile(const char * filename)
|
||||||
|
{
|
||||||
|
ifstream ifs(filename);
|
||||||
|
|
||||||
|
if ( ! ifs.is_open() )
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
string host;
|
||||||
|
while ( ! ifs.eof() )
|
||||||
|
{
|
||||||
|
ifs >> host;
|
||||||
|
m_hosts.push_back(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
ifs.close();
|
||||||
|
return 0;
|
||||||
|
}
|
17
distrib/distrib.h
Normal file
17
distrib/distrib.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
#ifndef DISTRIB_H
|
||||||
|
#define DISTRIB_H DISTRIB_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class distrib
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int readHostFile(const char * filename);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<std::string> m_hosts;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user