Table of Contents

hpc1 Keyword 2

make

Definition

make is the gnu utilities to maintain large groups of programs.

References

wikipedia

hpc1 Keyword 2 Phase 2

make

Definition

make is the gnu utilities to maintain large groups of programs.

References

wikipedia

Demonstration

Demonstration of the indicated keyword.

CFLAGS = -Wall
INC =
CC = gcc $(CFLAGS) $(INC)
SRC = $(shell /bin/ls -1 *.c)
OBJ = $(SRC:.c=.o)
BIN = linkedlistprog
all: $(SRC) $(OBJ) $(BIN)
 
debug: CC += -DDEBUG -g
debug: DEBUG = debug
debug: $(SRC) $(OBJ) $(BIN)
 
linkedlistprog:
ifneq ($(MAKECMDGOALS),debug)
    @printf "[B]   %-20s ... " "$(BIN)"
    @$(CC) -o $(BIN) $(OBJ) && echo "OK" || echo "FAIL"
else
    $(CC) -o $(BIN) $(OBJ)
endif
 
 
.c.o:
ifneq ($(MAKECMDGOALS),debug)
    @printf "[B]   %-20s ... " "$<"
    @$(CC) -c $< && echo "OK" || echo "FAIL"
else
    $(CC) -c $<
endif
 
copy:
    mkdir -p ~/src/data/linkedlist1
    cp -v /var/public/data/fall2012/linkedlist1/* ~/src/data/linkedlist1/
 
clean:
    rm -f $(OBJ) $(BIN) core