File tree Expand file tree Collapse file tree 1 file changed +28
-10
lines changed
Expand file tree Collapse file tree 1 file changed +28
-10
lines changed Original file line number Diff line number Diff line change 1- all : args/args.c eatmemory.c
1+ CC := gcc
2+ CFLAGS := -Wall -Wextra -std=c99
3+ LDFLAGS :=
4+ SRC := $(shell find . -type f -name '* .c')
5+ EXE := eatmemory
6+ PREFIX := /usr/local
7+ INSTALL_DIR := $(PREFIX ) /bin
28
3- ifeq ($(shell uname 2>/dev/null) , AIX)
4- gcc -maix64 args/args.c eatmemory.c -o eatmemory
5- else
6- $(CC) args/args.c eatmemory.c -o eatmemory
7- endif
9+ # Default target: Build the eatmemory program
10+ all : $(EXE )
811
12+ $(EXE ) : $(SRC )
13+ $(CC ) $(CFLAGS ) -o $@ $^ $(LDFLAGS )
914
10- install : eatmemory
11- mkdir -p $(PREFIX ) /bin
12- install -m 0755 eatmemory $(PREFIX ) /bin/
15+ # Install the executable to the specified PREFIX directory
16+ install : $(EXE )
17+ mkdir -p $(INSTALL_DIR )
18+ install -m 755 $< $(INSTALL_DIR )
1319
20+ # Clean generated files
1421clean :
15- rm -rf * o eatmemory
22+ rm -f $(EXE )
23+
24+ # Display help message
25+ help :
26+ @echo " Usage: make [target] [PREFIX=/your/installation/path]"
27+ @echo " Targets:"
28+ @echo " all (default) - Build the eatmemory program"
29+ @echo " install - Install the executable to PREFIX/bin"
30+ @echo " clean - Remove generated files"
31+ @echo " help - Display this help message"
32+
33+ .PHONY : all install clean help
You can’t perform that action at this time.
0 commit comments