-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (28 loc) · 826 Bytes
/
Makefile
File metadata and controls
39 lines (28 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Simple Makefile for Lab 1
CC = gcc
CFLAGS = -std=c11 -Wall -Wextra -Wpedantic -O2
LDFLAGS =
BUILD_DIR = bin
SRC_DIR = src
PROGRAMS = $(BUILD_DIR)/hello $(BUILD_DIR)/calculator $(BUILD_DIR)/formats
all: $(PROGRAMS)
$(BUILD_DIR)/hello: $(SRC_DIR)/hello.c
@mkdir -p $(BUILD_DIR)
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
$(BUILD_DIR)/calculator: $(SRC_DIR)/calculator.c
@mkdir -p $(BUILD_DIR)
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
$(BUILD_DIR)/formats: $(SRC_DIR)/format_specifiers.c
@mkdir -p $(BUILD_DIR)
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
hello: $(BUILD_DIR)/hello
calculator: $(BUILD_DIR)/calculator
formats: $(BUILD_DIR)/formats
run-hello: hello
./$(BUILD_DIR)/hello
run-calculator: calculator
./$(BUILD_DIR)/calculator
run-formats: formats
./$(BUILD_DIR)/formats
clean:
rm -rf $(BUILD_DIR)/*.o $(PROGRAMS)