Skip to content

Commit

Permalink
Remove spaces that should not be added in Makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
HiGarfield committed Jan 21, 2025
1 parent 3a5b46d commit c32e85c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
CC ?= gcc

# Compiler flags
override CFLAGS := $(filter-out -std=% -ansi -W%, $(CFLAGS)) \
override CFLAGS := $(filter-out -std=% -ansi -W%,$(CFLAGS)) \
-std=c89 \
-pedantic \
-Wall \
Expand All @@ -13,7 +13,7 @@ override CFLAGS := $(filter-out -std=% -ansi -W%, $(CFLAGS)) \
-Werror

# If CHECK is set to 1, add stricter flags
ifeq ($(CHECK), 1)
ifeq ($(CHECK),1)
override CFLAGS += -Wshadow \
-Wcast-qual \
-Wconversion \
Expand Down Expand Up @@ -45,7 +45,7 @@ endif # $(CC) = gcc
endif # CHECK = 1

# If NOFLAGS is set to 1, set CFLAGS and LDFLAGS to empty
ifeq ($(NOFLAGS), 1)
ifeq ($(NOFLAGS),1)
override CFLAGS :=
override LDFLAGS :=
endif # NOFLAGS = 1
Expand All @@ -57,8 +57,8 @@ TARGET := cpulimit
UNAME ?= $(shell uname)

# Platform-specific linker flags
override LDFLAGS += $(if $(findstring FreeBSD, $(UNAME)), -lkvm,) \
$(if $(findstring Darwin, $(UNAME)), -lproc,)
override LDFLAGS += $(if $(findstring FreeBSD,$(UNAME)),-lkvm) \
$(if $(findstring Darwin,$(UNAME)),-lproc)

# Check for librt availability
override LDFLAGS += $(shell \
Expand All @@ -75,7 +75,7 @@ all: $(TARGET)

# Build target
$(TARGET): $(wildcard *.c *.h)
$(CC) $(CFLAGS) $(filter-out process_iterator_%.c %.h, $^) $(LDFLAGS) -o $@
$(CC) $(CFLAGS) $(filter-out process_iterator_%.c %.h,$^) $(LDFLAGS) -o $@

# Clean target
clean:
Expand Down
18 changes: 9 additions & 9 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
CC ?= gcc

# Compiler flags
override CFLAGS := $(filter-out -std=% -ansi -W%, $(CFLAGS)) \
override CFLAGS := $(filter-out -std=% -ansi -W%,$(CFLAGS)) \
-std=c89 \
-pedantic \
-Wall \
Expand All @@ -13,7 +13,7 @@ override CFLAGS := $(filter-out -std=% -ansi -W%, $(CFLAGS)) \
-Werror

# If CHECK is set to 1, add stricter flags
ifeq ($(CHECK), 1)
ifeq ($(CHECK),1)
override CFLAGS += -Wshadow \
-Wcast-qual \
-Wconversion \
Expand Down Expand Up @@ -45,21 +45,21 @@ endif # $(CC) = gcc
endif # CHECK = 1

# If NOFLAGS is set to 1, set CFLAGS and LDFLAGS to empty
ifeq ($(NOFLAGS), 1)
ifeq ($(NOFLAGS),1)
override CFLAGS :=
override LDFLAGS :=
endif # NOFLAGS = 1

# Target binaries and source directory
TARGETS := $(patsubst %.c, %, $(wildcard *.c))
TARGETS := $(patsubst %.c,%,$(wildcard *.c))
SRC := ../src

# Detect operating system
UNAME ?= $(shell uname)

# Platform-specific linker flags
override LDFLAGS += $(if $(findstring FreeBSD, $(UNAME)), -lkvm,) \
$(if $(findstring Darwin, $(UNAME)), -lproc,)
override LDFLAGS += $(if $(findstring FreeBSD,$(UNAME)),-lkvm) \
$(if $(findstring Darwin,$(UNAME)),-lproc)

# Check for librt availability
override LDFLAGS += $(shell \
Expand All @@ -76,14 +76,14 @@ all: $(TARGETS)

# Target rules
busy: busy.c $(wildcard $(SRC)/util.*)
$(CC) $(CFLAGS) $(filter-out %.h, $^) -lpthread $(LDFLAGS) -o $@
$(CC) $(CFLAGS) $(filter-out %.h,$^) -lpthread $(LDFLAGS) -o $@

multi_process_busy: multi_process_busy.c
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@

process_iterator_test: process_iterator_test.c \
$(filter-out $(SRC)/cpulimit.c, $(wildcard $(SRC)/*.c $(SRC)/*.h))
$(CC) $(CFLAGS) $(filter-out $(SRC)/process_iterator_%.c %.h, $^) $(LDFLAGS) -o $@
$(filter-out $(SRC)/cpulimit.c,$(wildcard $(SRC)/*.c $(SRC)/*.h))
$(CC) $(CFLAGS) $(filter-out $(SRC)/process_iterator_%.c %.h,$^) $(LDFLAGS) -o $@

# Clean target
clean:
Expand Down

0 comments on commit c32e85c

Please sign in to comment.