<commit_before># Makefile for NULLC
# <NAME> <<EMAIL>>
# Aug 3, 2010

config=debug

REG_CFLAGS=-g -W
COMP_CFLAGS=-g -W -D NULLC_NO_EXECUTOR

ifeq ($(config),release)
	REG_CFLAGS+=-O3 -DNDEBUG
	COMP_CFLAGS+=-O3 -DNDEBUG
endif

ifeq ($(config),coverage)
	REG_CFLAGS+=-coverage
	COMP_CFLAGS+=-coverage
endif

LIB_SOURCES = \
  NULLC/BinaryCache.cpp \
  NULLC/Bytecode.cpp \
  NULLC/Callbacks.cpp \
  NULLC/CodeGen_X86.cpp \
  NULLC/CodeInfo.cpp \
  NULLC/Compiler.cpp \
  NULLC/Executor_Common.cpp \
  NULLC/Executor.cpp \
  NULLC/Executor_X86.cpp \
  NULLC/Lexer.cpp \
  NULLC/Linker.cpp \
  NULLC/nullc.cpp \
  NULLC/Parser.cpp \
  NULLC/stdafx.cpp \
  NULLC/StdLib.cpp \
  NULLC/StrAlgo.cpp \
  NULLC/SyntaxTree.cpp \
  NULLC/SyntaxTreeEvaluate.cpp \
  NULLC/SyntaxTreeGraph.cpp \
  NULLC/SyntaxTreeTranslate.cpp \
  NULLC/Translator_X86.cpp

LIB_TARGETS = \
  temp/BinaryCache.o \
  temp/Bytecode.o \
  temp/Callbacks.o \
  temp/CodeGen_X86.o \
  temp/CodeInfo.o \
  temp/Compiler.o \
  temp/Executor_Common.o \
  temp/Executor.o \
  temp/Executor_X86.o \
  temp/Lexer.o \
  temp/Linker.o \
  temp/nullc.o \
  temp/Parser.o \
  temp/stdafx.o \
  temp/StdLib.o \
  temp/StrAlgo.o \
  temp/SyntaxTree.o \
  temp/SyntaxTreeEvaluate.o \
  temp/SyntaxTreeGraph.o \
  temp/SyntaxTreeTranslate.o \
  temp/Translator_X86.o


STDLIB_SOURCES = \
  NULLC/includes/canvas.cpp \
  NULLC/includes/dynamic.cpp \
  NULLC/includes/file.cpp \
  NULLC/includes/gc.cpp \
  NULLC/includes/io.cpp \
  NULLC/includes/list.cpp \
  NULLC/includes/map.cpp \
  NULLC/includes/math.cpp \
  NULLC/includes/pugi.cpp \
  NULLC/includes/random.cpp \
  NULLC/includes/string.cpp \
  NULLC/includes/time.cpp \
  NULLC/includes/typeinfo.cpp \
  NULLC/includes/vector.cpp

PUGIXML_SOURCES = \
  external/pugixml/pugixml.cpp


STDLIB_TARGETS = \
  temp/lib/canvas.o \
  temp/lib/dynamic.o \
  temp/lib/file.o \
  temp/lib/gc.o \
  temp/lib/io.o \
  temp/lib/list.o \
  temp/lib/map.o \
  temp/lib/math.o \
  temp/lib/pugi.o \
  temp/lib/random.o \
  temp/lib/string.o \
  temp/lib/time.o \
  temp/lib/typeinfo.o \
  temp/lib/vector.o

PUGIXML_TARGETS = \
  temp/pugixml.o

all: temp/.dummy temp/compiler/.dummy temp/lib/.dummy temp/tests/.dummy \
    bin/nullcl TestRun bin/ConsoleCalc bin/nullclib

ifeq ($(config),coverage)
test: temp/.dummy temp/compiler/.dummy temp/lib/.dummy temp/tests/.dummy \
    bin/nullcl TestRun bin/ConsoleCalc bin/nullclib
	./TestRun
	gcov -o temp NULLC/BinaryCache.cpp NULLC/nullc.cpp NULLC/Bytecode.cpp NULLC/Parser.cpp NULLC/Callbacks.cpp NULLC/stdafx.cpp NULLC/StdLib.cpp NULLC/CodeInfo.cpp NULLC/StrAlgo.cpp NULLC/Compiler.cpp NULLC/SyntaxTree.cpp NULLC/Executor_Common.cpp NULLC/SyntaxTreeEvaluate.cpp NULLC/Executor.cpp NULLC/SyntaxTreeGraph.cpp NULLC/Lexer.cpp NULLC/Linker.cpp
else
test: temp/.dummy temp/compiler/.dummy temp/lib/.dummy temp/tests/.dummy \
    bin/nullcl TestRun bin/ConsoleCalc bin/nullclib
	./TestRun
endif

temp/lib/%.o: NULLC/includes/%.cpp
	$(CXX) $(REG_CFLAGS) -c $< -o $@

temp/%.o: NULLC/%.cpp
	$(CXX) $(REG_CFLAGS) -c $< -o $@

${PUGIXML_TARGETS}: $(PUGIXML_SOURCES)
	$(CXX) $(REG_CFLAGS) -c $< -o $@

#~ ${LIB_TARGETS}: ${LIB_SOURCES}
#~ $(CXX) $(REG_CFLAGS) -c $^ -o $@
#~
#~ ${STDLIB_TARGETS}: ${STDLIB_SOURCES}
#~ $(CXX) $(REG_CFLAGS) -c $^ -o $@

temp/.dummy:
	mkdir -p temp
	touch temp/.dummy

temp/compiler/.dummy:
	mkdir -p temp/compiler
	touch temp/compiler/.dummy

temp/lib/.dummy:
	mkdir -p temp/lib
	touch temp/lib/.dummy

temp/tests/.dummy:
	mkdir -p temp/tests
	touch temp/tests/.dummy

bin/libnullc.a: ${LIB_TARGETS} ${STDLIB_TARGETS} ${PUGIXML_TARGETS}
	$(AR) rcs $@ $^

clean:
	rm -rf temp/
	rm -f bin/*.a

# Compiling NULLC compiler-only lib
COMPILERLIB_SOURCES = \
  NULLC/BinaryCache.cpp \
  NULLC/Bytecode.cpp \
  NULLC/CodeInfo.cpp \
  NULLC/nullc.cpp \
  NULLC/stdafx.cpp \
  NULLC/StrAlgo.cpp \
  NULLC/Callbacks.cpp \<commit_msg>Added Makefile flag to build nullc with dyncall library for external function calls<commit_after># Makefile for NULLC
# <NAME> <<EMAIL>>
# Aug 3, 2010

config=debug
extcall=manual

REG_CFLAGS=-g -W
COMP_CFLAGS=-g -W -D NULLC_NO_EXECUTOR

ifeq ($(config),release)
	REG_CFLAGS+=-O3 -DNDEBUG
	COMP_CFLAGS+=-O3 -DNDEBUG
endif

ifeq ($(config),coverage)
	REG_CFLAGS+=-coverage
	COMP_CFLAGS+=-coverage
endif

ifeq ($(extcall),dyncall)
	REG_CFLAGS+=-DNULLC_USE_DYNCALL
	COMP_CFLAGS+=-DNULLC_USE_DYNCALL
endif

LIB_SOURCES = \
  NULLC/BinaryCache.cpp \
  NULLC/Bytecode.cpp \
  NULLC/Callbacks.cpp \
  NULLC/CodeGen_X86.cpp \
  NULLC/CodeInfo.cpp \
  NULLC/Compiler.cpp \
  NULLC/Executor_Common.cpp \
  NULLC/Executor.cpp \
  NULLC/Executor_X86.cpp \
  NULLC/Lexer.cpp \
  NULLC/Linker.cpp \
  NULLC/nullc.cpp \
  NULLC/Parser.cpp \
  NULLC/stdafx.cpp \
  NULLC/StdLib.cpp \
  NULLC/StrAlgo.cpp \
  NULLC/SyntaxTree.cpp \
  NULLC/SyntaxTreeEvaluate.cpp \
  NULLC/SyntaxTreeGraph.cpp \
  NULLC/SyntaxTreeTranslate.cpp \
  NULLC/Translator_X86.cpp

LIB_TARGETS = \
  temp/BinaryCache.o \
  temp/Bytecode.o \
  temp/Callbacks.o \
  temp/CodeGen_X86.o \
  temp/CodeInfo.o \
  temp/Compiler.o \
  temp/Executor_Common.o \
  temp/Executor.o \
  temp/Executor_X86.o \
  temp/Lexer.o \
  temp/Linker.o \
  temp/nullc.o \
  temp/Parser.o \
  temp/stdafx.o \
  temp/StdLib.o \
  temp/StrAlgo.o \
  temp/SyntaxTree.o \
  temp/SyntaxTreeEvaluate.o \
  temp/SyntaxTreeGraph.o \
  temp/SyntaxTreeTranslate.o \
  temp/Translator_X86.o


STDLIB_SOURCES = \
  NULLC/includes/canvas.cpp \
  NULLC/includes/dynamic.cpp \
  NULLC/includes/file.cpp \
  NULLC/includes/gc.cpp \
  NULLC/includes/io.cpp \
  NULLC/includes/list.cpp \
  NULLC/includes/map.cpp \
  NULLC/includes/math.cpp \
  NULLC/includes/pugi.cpp \
  NULLC/includes/random.cpp \
  NULLC/includes/string.cpp \
  NULLC/includes/time.cpp \
  NULLC/includes/typeinfo.cpp \
  NULLC/includes/vector.cpp

PUGIXML_SOURCES = \
  external/pugixml/pugixml.cpp

STDLIB_TARGETS = \
  temp/lib/canvas.o \
  temp/lib/dynamic.o \
  temp/lib/file.o \
  temp/lib/gc.o \
  temp/lib/io.o \
  temp/lib/list.o \
  temp/lib/map.o \
  temp/lib/math.o \
  temp/lib/pugi.o \
  temp/lib/random.o \
  temp/lib/string.o \
  temp/lib/time.o \
  temp/lib/typeinfo.o \
  temp/lib/vector.o

PUGIXML_TARGETS = \
  temp/pugixml.o

DYNCALL_TARGETS = \
  temp/dyncall/dyncall_api.o \
  temp/dyncall/dyncall_callvm.o \
  temp/dyncall/dyncall_callvm_base.o \
  temp/dyncall/dyncall_struct.o \
  temp/dyncall/dyncall_vector.o \
  temp/dyncall_s/dyncall_call.o

all: temp/.dummy temp/compiler/.dummy temp/lib/.dummy temp/tests/.dummy \
    bin/nullcl TestRun bin/ConsoleCalc bin/nullclib

ifeq ($(config),coverage)
test: temp/.dummy temp/compiler/.dummy temp/lib/.dummy temp/tests/.dummy \
    bin/nullcl TestRun bin/ConsoleCalc bin/nullclib
	./TestRun
	gcov -o temp NULLC/BinaryCache.cpp NULLC/nullc.cpp NULLC/Bytecode.cpp NULLC/Parser.cpp NULLC/Callbacks.cpp NULLC/stdafx.cpp NULLC/StdLib.cpp NULLC/CodeInfo.cpp NULLC/StrAlgo.cpp NULLC/Compiler.cpp NULLC/SyntaxTree.cpp NULLC/Executor_Common.cpp NULLC/SyntaxTreeEvaluate.cpp NULLC/Executor.cpp NULLC/SyntaxTreeGraph.cpp NULLC/Lexer.cpp NULLC/Linker.cpp
else
test: temp/.dummy temp/compiler/.dummy temp/lib/.dummy temp/tests/.dummy \
    bin/nullcl TestRun bin/ConsoleCalc bin/nullclib
	./TestRun
endif

temp/lib/%.o: NULLC/includes/%.cpp
	$(CXX) $(REG_CFLAGS) -c $< -o $@

temp/%.o: NULLC/%.cpp
	$(CXX) $(REG_CFLAGS) -c $< -o $@

${PUGIXML_TARGETS}: $(PUGIXML_SOURCES)
	$(CXX) $(REG_CFLAGS) -c $< -o $@

temp/dyncall/%.o: external/dyncall/%.c
	$(CXX) $(REG_CFLAGS) -c $< -o $@

temp/dyncall_s/%.o: external/dyncall/%.S
	$(CXX) $(REG_CFLAGS) -c $< -o $@

#~ ${LIB_TARGETS}: ${LIB_SOURCES}
#~ $(CXX) $(REG_CFLAGS) -c $^ -o $@
#~
#~ ${STDLIB_TARGETS}: ${STDLIB_SOURCES}
#~ $(CXX) $(REG_CFLAGS) -c $^ -o $@

temp/.dummy:
	mkdir -p temp
	touch temp/.dummy

temp/compiler/.dummy:
	mkdir -p temp/compiler
	touch temp/compiler/.dummy
	mkdir -p temp/dyncall
	touch temp/dyncall/.dummy
	mkdir -p temp/dyncall_s
	touch temp/dyncall_s/.dummy

temp/lib/.dummy:
	mkdir -p temp/lib
	touch temp/lib/.dummy

temp/tests/.dummy:
	mkdir -p temp/tests
	touch temp/tests/.dummy

ifeq ($(extcall),dyncall)
bin/libnullc.a: ${LIB_TARGETS} ${STDLIB_TARGETS} ${PUGIXML_TARGETS} ${DYNCALL_TARGETS}
	$(AR) rcs $@ $^
else
bin/libnullc.a: ${LIB_TARGETS} ${STDLIB_TARGETS} ${PUGIXML_TARGETS}
	$(AR) rcs $@ $^
endif

clean:
	rm -rf temp/
	rm -f bin/*.a

# Compiling NULLC compiler-only lib
COMPILERLIB_SOURCES = \
  NULLC/BinaryCache.cpp \
  NULLC/Bytecode.cpp \
  NULLC/CodeInfo.cpp \
  NULLC/nullc.cpp \
  NULLC/stdafx.cpp \
  NULLC/StrAlgo.cpp \
  NULLC/Callbacks.cpp \
{'fraction_non_alphanumeric': 0.14959159859976662, 'fraction_numerical': 0.004434072345390899, 'mean_word_length': 3.054399243140965, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2413045', 'n_tokens_mistral': 3747, 'n_tokens_neox': 3592, 'n_words': 534}