diff --git a/src/.gitignore b/src/.gitignore index ee111f6..f9ddb8c 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,6 +1,4 @@ * !.gitignore -!cat.c -!touch.c -!yes.c +!*.c !Makefile diff --git a/src/Makefile b/src/Makefile index 0bf4ab2..0cbf7f3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,13 +1,15 @@ -CC = gcc +CC= gcc +SRCFILES= cat.c touch.c yes.c mkdir.c +OBJFILES= cat touch yes mkdir CFLAGS= -Wall -Wextra -LFLAGS= -all: cat touch yes +.PHONY: all clean -main: $(OBJFILES) - $(CC) cat.c -o cat - $(CC) touch.c -o touch - $(CC) yes.c -o yes +all: + $(CC) $(CFLAGS) cat.c -o cat + $(CC) $(CFLAGS) touch.c -o touch + $(CC) $(CFLAGS) yes.c -o yes + $(CC) $(CFLAGS) mkdir.c -o mkdir -test: main - ./cat ../tests/test.txt +clean: + @rm ${OBJFILES} diff --git a/src/mkdir.c b/src/mkdir.c new file mode 100644 index 0000000..d9e202f --- /dev/null +++ b/src/mkdir.c @@ -0,0 +1,9 @@ +#include +#include + +int main(int argc, char *argv[]){ + mode_t mode = 0755; + for (int i = 1; i < argc; i++) { + mkdir(argv[i], mode); + } +}