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

View File

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