import os
import subprocess

class Compile:
	def __init__(self, files, output, compiler):
		self._files = []
		self.output = output
		self.compiler = compiler

		for file in files:
			ext = os.path.splitext(file)
			if len(ext) > 1 and not ext[1] == ".h":
				self._files.append(file)

	def compile(self):
		cmd = [self.compiler]	
		for f in self._files:
			cmd.append(f)

		cmd.append('-o')
		cmd.append(self.output)
		subprocess.call(cmd)