kopia lustrzana https://github.com/FreeSpacenav/spnavcfg
56 wiersze
1.3 KiB
Makefile
56 wiersze
1.3 KiB
Makefile
src = $(wildcard src/*.c)
|
|
obj = $(src:.c=.o)
|
|
dep = $(src:.c=.d)
|
|
bin = spnavcfg
|
|
|
|
warn = -pedantic -Wall
|
|
|
|
CC ?= gcc
|
|
SED = sed
|
|
CFLAGS = $(warn) $(dbg) $(opt) `pkg-config --cflags gtk+-2.0 gmodule-export-2.0` \
|
|
$(add_cflags) -MMD
|
|
LDFLAGS = `pkg-config --libs gtk+-2.0 gmodule-export-2.0` -lX11 $(add_ldflags)
|
|
|
|
$(bin): $(obj)
|
|
$(CC) -o $@ $(obj) $(LDFLAGS)
|
|
|
|
-include $(dep)
|
|
|
|
src/main.o: src/main.c src/ui.h
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
src/ui.h: ui/ui.xml
|
|
echo 'static const char *ui_xml =' >$@
|
|
$(SED) 's/"/\\"/g; s/^.*$$/ "&\\n"/' $< >>$@
|
|
echo ';' >>$@
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f $(obj) $(bin) src/ui.h
|
|
|
|
.PHONY: cleandep
|
|
cleandep:
|
|
rm -f $(dep)
|
|
|
|
.PHONY: install
|
|
install:
|
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
|
cp $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin)
|
|
for i in 48 128 256; do \
|
|
destdir=$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${i}x$${i}/apps; \
|
|
mkdir -p $$destdir; \
|
|
cp icons/spnavcfg-$${i}x$${i}.png $$destdir/spnavcfg.png; \
|
|
done
|
|
mkdir -p $(DESTDIR)$(PREFIX)/share/applications
|
|
cp -a icons/spnavcfg.desktop $(DESTDIR)$(PREFIX)/share/applications/
|
|
|
|
|
|
.PHONY: uninstall
|
|
uninstall:
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/$(bin)
|
|
for i in 48 128 256; do \
|
|
destdir=$(DESTDIR)$(PREFIX)/share/icons/hicolor/$${i}x$${i}/apps; \
|
|
rm -f $${destdir}/spnavcfg.png; \
|
|
done
|
|
rm -f $(DESTDIR)$(PREFIX)/share/applications/spnavcfg.desktop
|