add: project 2
This commit is contained in:
parent
2b3c28d249
commit
4e8e564b44
25 changed files with 921 additions and 3 deletions
31
project2/Makefile
Normal file
31
project2/Makefile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
SRC_DIR := ./src
|
||||
BUILD_DIR := ./build
|
||||
|
||||
EXEC ?= cpu-schedulers
|
||||
INSTALL ?= $(PREFIX)/bin/
|
||||
|
||||
# Find all the C files we want to compile
|
||||
SRCS := $(shell find $(SRC_DIR) -name '*.c')
|
||||
OBJS := $(SRCS:$(SRC_DIR)/%.c=$(BUILD_DIR)/%.o)
|
||||
|
||||
.PHONY: build install clean
|
||||
|
||||
build: $(BUILD_DIR)/$(EXEC)
|
||||
install: build
|
||||
mkdir -p $(INSTALL)
|
||||
cp $(BUILD_DIR)/$(EXEC) $(INSTALL)
|
||||
|
||||
|
||||
# Link
|
||||
$(BUILD_DIR)/$(EXEC): $(OBJS)
|
||||
$(CC) $^ -o $@ $(LDFLAGS)
|
||||
|
||||
# Compile
|
||||
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
|
||||
clean:
|
||||
rm -r $(BUILD_DIR)
|
||||
Loading…
Add table
Add a link
Reference in a new issue