28 lines
453 B
Makefile
28 lines
453 B
Makefile
CC = cc
|
|
COMPILER_OPTIONS = -Wall
|
|
BIN_DIR = obj
|
|
BINARIES = $(BIN_DIR)/hello_greeter
|
|
MAIN = $(BIN_DIR)/hello_greeter
|
|
OBJ = $(BIN_DIR)/hello_greeter.o \
|
|
$(BIN_DIR)/greeter.o
|
|
|
|
.PHONY: all
|
|
all: $(BINARIES)
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf $(BIN_DIR)
|
|
|
|
.PHONY: test
|
|
test: all
|
|
@$(MAIN)
|
|
@$(MAIN) Thomas
|
|
|
|
$(BIN_DIR)/%.o: %.c *.h
|
|
mkdir -p $(BIN_DIR)
|
|
$(CC) $(COMPILER_OPTIONS) -o $@ -c $<
|
|
|
|
$(MAIN): $(OBJ)
|
|
mkdir -p $(BIN_DIR)
|
|
$(CC) $(COMPILER_OPTIONS) -o $@ $^
|