ftpiiu_plugin/Makefile.linux

38 lines
1.1 KiB
Makefile

TARGET := linux/ftpd
BUILD := linux/build
CFILES := $(wildcard source/linux/*.c)
CXXFILES := $(wildcard source/*.cpp source/imgui/*.cpp source/linux/*.cpp)
OFILES := $(patsubst source/%,$(BUILD)/%,$(CFILES:.c=.c.o))
OXXFILES := $(patsubst source/%,$(BUILD)/%,$(CXXFILES:.cpp=.cpp.o))
CPPFLAGS := -g -Wall -pthread -Iinclude -Isource/linux \
`pkg-config --cflags gl glfw3` \
-DSTATUS_STRING="\"ftpd v$(VERSION)\"" \
-DFTPDCONFIG="\"ftpd.cfg\"" \
`curl-config --cflags`
CFLAGS := $(CPPFLAGS)
CXXFLAGS := $(CPPFLAGS) -std=gnu++2a
LDFLAGS := -pthread `curl-config --libs` `pkg-config --libs gl glfw3` -ldl
.PHONY: all clean
all: $(TARGET)
$(TARGET): $(OFILES) $(OXXFILES)
$(CXX) -o $@ $^ $(LDFLAGS)
$(OFILES): $(BUILD)/%.c.o : source/%.c
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
$(CC) -MMD -MP -MF $(BUILD)/$*.c.d $(CFLAGS) -c $< -o $@
$(OXXFILES): $(BUILD)/%.cpp.o : source/%.cpp
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
$(CXX) -MMD -MP -MF $(BUILD)/$*.c.d $(CXXFLAGS) -c $< -o $@
clean:
@$(RM) -r $(BUILD) $(TARGET)
-include $(shell find $(BUILD) -name \*.d 2>/dev/null)