I am trying to make a sublime text plugin to compile C using a make file, unfortunately it is all in python and I cannot get things to work :( could you please give me advice on passing data to the g++ make command?

Thanks in advance.

Here's a little blurb from Linux's 'man make'

6.9 Variables from the Environment

Variables in `make' can come from the environment in which `make' is
run. Every environment variable that `make' sees when it starts up is
transformed into a `make' variable with the same name and value.
However, an explicit assignment in the makefile, or with a command
argument, overrides the environment. (If the `-e' flag is specified,
then values from the environment override assignments in the makefile.
*Note Summary of Options: Options Summary. But this is not recommended

Thus, by setting the variable `CFLAGS' in your environment, you can
cause all C compilations in most makefiles to use the compiler switches
you prefer. This is safe for variables with standard or conventional
meanings because you know that no makefile will use them for other
things. (Note this is not totally reliable; some makefiles set
`CFLAGS' explicitly and therefore are not affected by the value in the

When `make' runs a command script, variables defined in the makefile
are placed into the environment of that command. This allows you to
pass values to sub-`make' invocations (*note Recursive Use of `make':
Recursion.). By default, only variables that came from the environment
or the command line are passed to recursive invocations. You can use
the `export' directive to pass other variables. *Note Communicating
Variables to a Sub-`make': Variables/Recursion, for full details.

Other use of variables from the environment is not recommended. It
is not wise for makefiles to depend for their functioning on
environment variables set up outside their control, since this would
cause different users to get different results from the same makefile.
This is against the whole purpose of most makefiles.

Such problems would be especially likely with the variable `SHELL',
which is normally present in the environment to specify the user's
choice of interactive shell. It would be very undesirable for this
choice to affect `make'; so, `make' handles the `SHELL' environment
variable in a special way; see *Note Choosing the Shell::.

thanks, but I dont see how it's helpful?

Here is a typical make file created by DevCPP for the TextColor2 console C project ...

# Project: TextColor2
# Makefile created by Dev-C++

CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  = 
OBJ  = main.o $(RES)
LINKOBJ  = main.o $(RES)
LIBS =  -L"D:/Dev-Cpp/lib"  
INCS =  -I"D:/Dev-Cpp/include" 
CXXINCS =  -I"D:/Dev-Cpp/include/c++/3.3.1"  -I"D:/Dev-Cpp/include/c++/3.3.1/mingw32"  -I"D:/Dev-Cpp/include/c++/3.3.1/backward"  -I"D:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include"  -I"D:/Dev-Cpp/include" 
BIN  = TextColor2.exe

.PHONY: all all-before all-after clean clean-custom

all: all-before TextColor2.exe all-after

clean: clean-custom
	rm -f $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CC) $(LINKOBJ) -o "TextColor2.exe" $(LIBS)

main.o: main.c
	$(CC) -c main.c -o main.o $(CFLAGS)