-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
26 lines (22 loc) · 883 Bytes
/
Makefile
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
CC := g++
LD := ld -r -b binary
SRC_DIR := src
BUILD_DIR := build
TARGET := bin/sunrise
SOURCES := $(shell find $(SRC_DIR) -type f -name *.cpp)
OBJECTS := $(patsubst $(SRC_DIR)/%,$(BUILD_DIR)/%,$(SOURCES:.cpp=.o))
RESOURCES := $(shell find $(SRC_DIR) -type f -name *.xml)
STATIC_OBJECTS := $(patsubst $(SRC_DIR)/%,$(BUILD_DIR)/%,$(RESOURCES:.xml=.o))
CFLAGS := -g $(shell pkg-config --cflags dbus-1)
LIB := -pthread $(shell pkg-config --libs dbus-1)
$(TARGET): $(STATIC_OBJECTS) $(OBJECTS)
@mkdir -p bin/
@echo "$(CC) $^ -o $(TARGET) $(LIB)"; $(CC) $^ -o $(TARGET) $(LIB)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(BUILD_DIR)
@echo "$(CC) $(CFLAGS) -c -o $@ $<"; $(CC) $(CFLAGS) -c -o $@ $<
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.xml
@mkdir -p $(BUILD_DIR)
@echo "$(LD) -o $@ $<"; $(LD) -o $@ $<
clean:
@echo "$(RM) -r $(BUILD_DIR) $(TARGET)"; $(RM) -r $(BUILD_DIR) $(TARGET)