52 lines
1.2 KiB
Makefile
52 lines
1.2 KiB
Makefile
CC = gcc
|
|
CC_OPTIONS = -Wall
|
|
|
|
BIN_DIR = bin
|
|
BINARIES = \
|
|
$(BIN_DIR)/countdown \
|
|
$(BIN_DIR)/file_line_no \
|
|
$(BIN_DIR)/hello \
|
|
$(BIN_DIR)/hello_cmdline \
|
|
$(BIN_DIR)/hello_define \
|
|
$(BIN_DIR)/leet \
|
|
$(BIN_DIR)/numberguess \
|
|
$(BIN_DIR)/pipe_rechner \
|
|
$(BIN_DIR)/print_array \
|
|
$(BIN_DIR)/print_array_pointer \
|
|
$(BIN_DIR)/print_file \
|
|
$(BIN_DIR)/read_write \
|
|
$(BIN_DIR)/reverse \
|
|
$(BIN_DIR)/sizeof \
|
|
$(BIN_DIR)/socket_client \
|
|
$(BIN_DIR)/socket_server \
|
|
$(BIN_DIR)/swap \
|
|
$(BIN_DIR)/hello_greeter \
|
|
$(BIN_DIR)/vararg_sum \
|
|
$(BIN_DIR)/argv_printer \
|
|
$(BIN_DIR)/function_pointer \
|
|
$(BIN_DIR)/struct_book \
|
|
$(BIN_DIR)/typedef \
|
|
$(BIN_DIR)/malloc_free \
|
|
$(BIN_DIR)/union \
|
|
$(BIN_DIR)/strings \
|
|
$(BIN_DIR)/threads
|
|
|
|
|
|
.PHONY: all
|
|
all: $(BINARIES)
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
-rm $(BINARIES)
|
|
-rm $(BIN_DIR)/*.o
|
|
-rmdir $(BIN_DIR)
|
|
|
|
$(BIN_DIR)/%: %.c
|
|
mkdir -p $(BIN_DIR)
|
|
$(CC) $(CC_OPTIONS) -o $@ $<
|
|
|
|
$(BIN_DIR)/hello_greeter: greeter/greeter.c greeter/greeter.h greeter/hello_greeter.c
|
|
$(CC) $(CC_OPTIONS) -c greeter/greeter.c -o $(BIN_DIR)/greeter.o
|
|
$(CC) $(CC_OPTIONS) -c greeter/hello_greeter.c -o $(BIN_DIR)/hello_greeter.o
|
|
$(CC) $(CC_OPTIONS) $(BIN_DIR)/greeter.o $(BIN_DIR)/hello_greeter.o -o $(BIN_DIR)/hello_greeter
|