Makefiles

This commit is contained in:
Timo Schmidt 2023-03-26 08:19:07 +02:00
parent 79472d8999
commit 97d992c651
2 changed files with 7 additions and 9 deletions

View File

@ -11,7 +11,7 @@ _OBJ=$(SRC:.c=.o)
OBJ=$(patsubst %,$(OBJDIR)/%,$(_OBJ))
DEPS=$(patsubst %,$(INCDIR)/%,$(HEADERS))
.PHONY: clean install uninstall fclean all re
.PHONY: clean install uninstall fclean all re makedirs
all: $(BUILDDIR)/$(NAME)
@ -20,7 +20,7 @@ $(BUILDDIR)/$(NAME): $(OBJ)
$(OBJDIR)/%.o: %.c $(DEPS)
norminette $<
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) -o $@ -c $<
clean:
$(RM) $(wildcard $(OBJ))

View File

@ -6,19 +6,19 @@ INCDIR=include
OBJDIR=obj
BUILDDIR=build
DIRS=
DIRS+=${INCDIR}
DIRS+=${OBJDIR}
DIRS+=${BUILDDIR}
DIRS+=$(INCDIR)
DIRS+=$(OBJDIR)
DIRS+=$(BUILDDIR)
# includes
INCS=-I${INCDIR}
INCS=-I$(INCDIR)
# flags
CFLAGS=
CFLAGS+=-Wall
CFLAGS+=-Wextra
#CFLAGS+=-Werror
CFLAGS+=${INCS}
CFLAGS+=$(INCS)
LDFLAGS=
# compiler and linker
@ -30,5 +30,3 @@ RMDIR=/bin/rmdir --ignore-fail-on-non-empty
MKDIR=/bin/mkdir -p
CP=/bin/cp -f
CHMOD=/bin/chmod
$(shell mkdir -p $(DIRS))