From 82e55dde69dc89fdf06e751b75449f35836282a1 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Mon, 1 May 2023 18:43:32 -0400 Subject: refactor and xargs --- Makefile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 611ea8d..708443e 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,24 @@ CC = gcc -INCFLAGS = -Isrc +SOURCE = src -CCFLAGS = -std=c99 -Wall -Wextra -pedantic -O2 -D_DEFAULT_SOURCE +MAJOR = 0 +MINOR = 0 +PATCH = 1 + +INCFLAGS = $(shell echo $(SOURCE) | xargs printf -- '-I%s') + +CCFLAGS = -std=c99 -Wall -Wextra -pedantic -O2 +CCFLAGS += -D_DEFAULT_SOURCE -DMAJOR=$(MAJOR) -DMINOR=$(MINOR) -DPATCH=$(PATCH) -DCHECK_LINK CCFLAGS += $(INCFLAGS) +LDFLAGS = -s LDFLAGS += $(INCFLAGS) BIN = bin APP = $(BIN)/app -SRC = $(shell find src -name "*.c") +SRC = $(shell find $(SOURCE) -name "*.c") +DIR = $(shell find $(SOURCE) -type d) OBJ = $(SRC:%.c=$(BIN)/%.o) .PHONY: dirs run clean build install uninstall @@ -17,10 +26,7 @@ OBJ = $(SRC:%.c=$(BIN)/%.o) EOF: clean build dirs: - mkdir -p ./$(BIN) - mkdir -p ./$(BIN)/src - mkdir -p ./$(BIN)/src/util - mkdir -p ./$(BIN)/src/commands + echo $(DIR) | xargs printf -- '$(BIN)/%s\n' | xargs mkdir -p run: build $(APP) -- cgit v1.2.3-freya