def write(self):
    print('Write makefile')
    library = os.path.basename(self.library)
    link_command = self.link_command
    compile_command = self.compile_command
    compile_pre = ' '.join(list(self.compile_pre))
    compile_post = ' '.join(list(self.compile_post))
    build = self.build_dir
    link_flags = ' '.join(self.link_options)
    includes = ' '.join(self.includes)
    sources = ' \\\n     '.join(self.sources)
    with open('Makefile', 'w') as fd:
        print(('LIB = %s' % library), file=fd)
        print(('CC = %s' % compile_command), file=fd)
        print(('LINK = %s' % link_command), file=fd)
        print(('CFLAGS = %s %s' % (compile_pre, compile_post)), file=fd)
        print(('INCLUDES = %s' % includes), file=fd)
        print(('BUILD = %s' % build), file=fd)
        print(('LINKFLAGS = %s' % link_flags), file=fd)
        print(('SRCS = %s' % sources), file=fd)
        print("\nall: $(LIB)\n\nrwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))\n#build/src/jp_thunk.cpp: $(call rwildcard,native/java,*.java)\n#\tpython setup.py build_thunk\n\nDEPDIR = build/deps\n$(DEPDIR): ; @mkdir -p $@\n\nDEPFILES := $(SRCS:%.cpp=$(DEPDIR)/%.d)\n\ndeps: $(DEPFILES)\n\n%/:\n\techo $@\n\n$(DEPDIR)/%.d: %.cpp \n\tmkdir -p $(dir $@)\n\t$(CC) $(INCLUDES) -MT $(patsubst $(DEPDIR)%,'$$(BUILD)%',$(patsubst %.d,%.o,$@)) -MM $< -o $@\n\nOBJS = $(addprefix $(BUILD)/, $(SRCS:.cpp=.o))\n\n\n$(BUILD)/%.o: %.cpp\n\tmkdir -p $(dir $@)\n\t$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@\n\n\n$(LIB): $(OBJS)\n\t$(LINK) $(OBJS) $(LINKFLAGS) -o $@\n\n\n-include $(DEPFILES)\n", file=fd)
def write(self):
    print('Write makefile')
    library = os.path.basename(self.library)
    link_command = self.link_command
    compile_command = self.compile_command
    compile_pre = ' '.join(list(self.compile_pre))
    compile_post = ' '.join(list(self.compile_post))
    build = self.build_dir
    link_flags = ' '.join(self.link_options)
    includes = ' '.join(self.includes)
    sources = ' \\\n     '.join(self.sources)
    with open('Makefile', 'w') as fd:
        print(('LIB = %s' % library), file=fd)
        print(('CC = %s' % compile_command), file=fd)
        print(('LINK = %s' % link_command), file=fd)
        print(('CFLAGS = %s %s' % (compile_pre, compile_post)), file=fd)
        print(('INCLUDES = %s' % includes), file=fd)
        print(('BUILD = %s' % build), file=fd)
        print(('LINKFLAGS = %s' % link_flags), file=fd)
        print(('SRCS = %s' % sources), file=fd)
        print("\nall: $(LIB)\n\nrwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))\n#build/src/jp_thunk.cpp: $(call rwildcard,native/java,*.java)\n#\tpython setup.py build_thunk\n\nDEPDIR = build/deps\n$(DEPDIR): ; @mkdir -p $@\n\nDEPFILES := $(SRCS:%.cpp=$(DEPDIR)/%.d)\n\ndeps: $(DEPFILES)\n\n%/:\n\techo $@\n\n$(DEPDIR)/%.d: %.cpp \n\tmkdir -p $(dir $@)\n\t$(CC) $(INCLUDES) -MT $(patsubst $(DEPDIR)%,'$$(BUILD)%',$(patsubst %.d,%.o,$@)) -MM $< -o $@\n\nOBJS = $(addprefix $(BUILD)/, $(SRCS:.cpp=.o))\n\n\n$(BUILD)/%.o: %.cpp\n\tmkdir -p $(dir $@)\n\t$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@\n\n\n$(LIB): $(OBJS)\n\t$(LINK) $(OBJS) $(LINKFLAGS) -o $@\n\n\n-include $(DEPFILES)\n", file=fd)