-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (29 loc) · 705 Bytes
/
Makefile
File metadata and controls
39 lines (29 loc) · 705 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
C := gcc
CFLAGS := -Wall -Wextra -pedantic -g -std=gnu89
LDFLAGS :=
SRC_DIR := src
INCLUDE_DIR := include
BUILD_DIR := build
OBJ_DIR := $(BUILD_DIR)/obj
BIN_DIR := $(BUILD_DIR)/bin
SRCS := $(wildcard $(SRC_DIR)/*.c)
OBJS := $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRCS))
DEPS := $(OBJS:.o=.d)
TARGET := mipsify
.PHONY: all clean
all: $(TARGET)
$(TARGET): $(OBJS)
@mkdir -p $(@D)
$(CC) $(LDFLAGS) $^ -o $@
-include $(DEPS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -I$(INCLUDE_DIR) -MMD -c $< -o $@
clean:
$(RM) -r $(BUILD_DIR)
$(RM) mipsify
put:
sudo cp mipsify /usr/bin
# Add a phony target to force rebuilding 'mipsify'
force: clean all
install: all put clean