| 1 |
CC ?= gcc |
| 2 |
CXX ?= g++ |
| 3 |
PROGRAM = exampleapp |
| 4 |
CXXFILES = main.cc exampleappwindow.cc exampleapplication.cc exampleappprefs.cc |
| 5 |
BUILT_SRC = resources.c |
| 6 |
OBJS = $(BUILT_SRC:.c=.o) $(CXXFILES:.cc=.o) |
| 7 |
DEPDIR = .deps |
| 8 |
CXXFLAGS = `pkg-config --cflags gtkmm-4.0` -std=c++17 -Wall -g |
| 9 |
CFLAGS = `pkg-config --cflags gtk4` |
| 10 |
LIBS = `pkg-config --libs gtkmm-4.0` |
| 11 |
GLIB_COMPILE_RESOURCES = $(shell pkg-config --variable=glib_compile_resources gio-2.0) |
| 12 |
GLIB_COMPILE_SCHEMAS = $(shell pkg-config --variable=glib_compile_schemas gio-2.0) |
| 13 |
|
| 14 |
all: $(PROGRAM) gschemas.compiled |
| 15 |
|
| 16 |
-include $(OBJS:%.o=$(DEPDIR)/%.Po) |
| 17 |
|
| 18 |
gschemas.compiled: org.gtkmm.exampleapp.gschema.xml |
| 19 |
$(GLIB_COMPILE_SCHEMAS) --strict --dry-run --schema-file=$< |
| 20 |
$(GLIB_COMPILE_SCHEMAS) . |
| 21 |
|
| 22 |
resources.c: exampleapp.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=. --generate-dependencies exampleapp.gresource.xml) |
| 23 |
$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=. --generate-source $< |
| 24 |
|
| 25 |
%.o: %.c |
| 26 |
@mkdir -p $(DEPDIR) |
| 27 |
$(CC) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(CFLAGS) $< |
| 28 |
@mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po |
| 29 |
|
| 30 |
%.o: %.cc |
| 31 |
@mkdir -p $(DEPDIR) |
| 32 |
$(CXX) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(CXXFLAGS) $< |
| 33 |
@mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po |
| 34 |
|
| 35 |
$(PROGRAM): $(OBJS) |
| 36 |
$(CXX) -o $(PROGRAM) $(OBJS) $(LIBS) |
| 37 |
|
| 38 |
clean: |
| 39 |
rm -f gschemas.compiled |
| 40 |
rm -f $(BUILT_SRC) |
| 41 |
rm -f $(OBJS) |
| 42 |
rm -f $(PROGRAM) |
| 43 |
|
| 44 |
install-desktop-file: |
| 45 |
@mkdir -p ~/.local/share/applications |
| 46 |
sed -e "s#@bindir@#$$PWD#" ../step1/exampleapp.desktop.in > ~/.local/share/applications/$(PROGRAM).desktop |
| 47 |
@mkdir -p ~/.local/share/icons/hicolor/48x48/apps |
| 48 |
cp ../step1/exampleapp.png ~/.local/share/icons/hicolor/48x48/apps |
| 49 |
|
| 50 |
install-gschema-file: |
| 51 |
if test -n "$(GSETTINGS_SCHEMA_DIR)" -a "$(GSETTINGS_SCHEMA_DIR)" != .; then \ |
| 52 |
mkdir -p "$(GSETTINGS_SCHEMA_DIR)"; \ |
| 53 |
cp org.gtkmm.exampleapp.gschema.xml "$(GSETTINGS_SCHEMA_DIR)"; \ |
| 54 |
$(GLIB_COMPILE_SCHEMAS) "$(GSETTINGS_SCHEMA_DIR)"; \ |
| 55 |
fi |