78 lines
1.4 KiB
Makefile
78 lines
1.4 KiB
Makefile
SHELL=/bin/bash
|
|
|
|
# configurable options
|
|
|
|
ifndef ($(SOURCES_DIR))
|
|
SOURCES_DIR := .
|
|
endif
|
|
|
|
ifndef ($(TESTS_DIR))
|
|
TESTS_DIR := .
|
|
endif
|
|
|
|
ifndef ($(BUILD_DIR))
|
|
BUILD_DIR := .
|
|
endif
|
|
|
|
CC := gcc
|
|
CXX := g++
|
|
|
|
|
|
# dependencies
|
|
|
|
PACKAGE_NAMES := gtk4 libadwaita-1
|
|
|
|
ifeq ($(TEST), 1)
|
|
# PACKAGE_NAMES += check # TODO: use check?
|
|
endif
|
|
|
|
|
|
# set up cflags and libs
|
|
|
|
CFLAGS := -D_FILE_OFFSET_BITS=64
|
|
LDFLAGS :=
|
|
|
|
CFLAGS += $(shell pkg-config --cflags $(PACKAGE_NAMES))
|
|
LDFLAGS += $(shell pkg-config --libs $(PACKAGE_NAMES))
|
|
|
|
ifeq ($(DEBUG),1)
|
|
CFLAGS += -O0 -pedantic -g -Wall -Wextra -Wcast-align \
|
|
-Wcast-qual -Wdisabled-optimization -Wformat=2 \
|
|
-Winit-self -Wlogical-op -Wmissing-declarations \
|
|
-Wmissing-include-dirs -Wredundant-decls -Wshadow \
|
|
-Wsign-conversion -Wstrict-overflow=5 \
|
|
-Wswitch-default -Wundef -Wno-unused
|
|
LDFLAGS +=
|
|
else
|
|
CFLAGS += -O3
|
|
LDFLAGS +=
|
|
endif
|
|
|
|
|
|
# set up targets
|
|
|
|
TARGETS := $(BUILD_DIR)/icfs_dialogue
|
|
|
|
ifeq ($(TEST), 1)
|
|
TARGETS += icfs_dialogue_test
|
|
endif
|
|
|
|
|
|
# build!
|
|
|
|
default: $(TARGETS)
|
|
|
|
.PHONY: clean icfs_dialogue_test
|
|
|
|
icfs_dialogue_test: $(BUILD_DIR)/icfs_dialogue
|
|
$(BUILD_DIR)/icfs_dialogue 666 cat /home/fedir /Downloads
|
|
|
|
$(BUILD_DIR)/icfs_dialogue: $(BUILD_DIR)/icfs_dialogue.o
|
|
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $(BUILD_DIR)/icfs_dialogue
|
|
|
|
$(BUILD_DIR)/icfs_dialogue.o: $(SOURCES_DIR)/icfs_dialogue.c
|
|
$(CC) $(CFLAGS) -c $< $(LDFLAGS) -o $(BUILD_DIR)/icfs_dialogue.o
|
|
|
|
clean:
|
|
rm $(BUILD_DIR)/*.o $(BUILD_DIR)/icfs_dialogue
|