Restructured repository and rewrote Makefile

This commit is contained in:
g1n 2022-06-28 17:47:58 +03:00
parent 1a8d76d7ca
commit 8ee74d84e3
Signed by: g1n
GPG Key ID: 8D352193D65D4E2C
3 changed files with 20 additions and 17 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*~
build

4
src/.gitignore vendored
View File

@ -1,4 +0,0 @@
*
!.gitignore
!*.c
!Makefile

View File

@ -1,17 +1,22 @@
CC= gcc
SRCFILES= cat.c touch.c yes.c mkdir.c echo.c ls.c
OBJFILES= cat touch yes mkdir echo ls
CFLAGS= -Wall -Wextra
CC=cc
BUILDDIR=../build
TESTSDIR=../tests
.PHONY: all clean
CFLAGS=-Wall -Wextra
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
$(CC) $(CFLAGS) echo.c -o echo
$(CC) $(CFLAGS) ls.c -o ls
CFILES=$(wildcard *.c)
OFILES=$(patsubst %.c, $(BUILDDIR)/%.o, $(CFILES))
.PHONY: all clean test
.SUFFIXES: .o .c
all: $(BUILDDIR) $(OFILES)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(BUILDDIR)/%.o: %.c
$(CC) $(CFLAGS) $< -o $@
clean:
@rm ${OBJFILES}
rm -rf $(BUILDDIR)