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