added distrib infrastructure

git-svn-id: svn://anubis/fart/trunk@220 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-04-05 13:11:44 +00:00
parent 08429c5e58
commit 0e818d1a92
4 changed files with 66 additions and 1 deletions

View File

@ -1,4 +1,6 @@
SHELL := bash
TARGET := fart
ifdef WIN32
export CPPFLAGS += -I"$(shell cd)"
@ -9,7 +11,7 @@ export CXXFLAGS := -Wall -O2
LDFLAGS := -lfl
SUBDIRS := util shapes main parser
SUBDIRS := util shapes main parser distrib
all: $(TARGET)

23
distrib/Makefile Normal file
View 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
View 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
View 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