diff --git a/makefile b/makefile new file mode 100644 index 0000000..4a0450b --- /dev/null +++ b/makefile @@ -0,0 +1,30 @@ +# Interface: +# make +# make build +# make format + +# Compiler +CC=gcc +# CC=tcc # <= faster compilation + +# Main file +SRC=wc.c +OUTPUT=wc + +## Flags +DEBUG= #'-g' +STANDARD=-std=c99 +WARNINGS=-Wall +OPTIMIZED=-O0 +# OPTIMIZED=-O3 #-Ofast + +## Formatter +STYLE_BLUEPRINT=webkit +FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) + +## make build +build: $(SRC) + $(CC) $(OPTIMIZED) $(DEBUG) $(SRC) -o $(OUTPUT) + +format: $(SRC) + $(FORMATTER) $(SRC) diff --git a/wc b/wc new file mode 100755 index 0000000..c592776 Binary files /dev/null and b/wc differ diff --git a/wc.c b/wc.c new file mode 100644 index 0000000..a12f360 --- /dev/null +++ b/wc.c @@ -0,0 +1,10 @@ +#include +#include + +int main(){ + char buffer[1]; + while(read(0,buffer,sizeof(buffer)) > 0){ + printf("%c", buffer[0]); + } + return 0; +}