ftpiiu_plugin/Makefile.linux
2022-10-03 21:52:19 -05:00

40 lines
1.2 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)\"" \
-DIMGUI_DISABLE_INCLUDE_IMCONFIG_H=1 \
-DIMGUI_IMPL_OPENGL_LOADER_GLAD=1 \
-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)