"Fossies" - the Fresh Open Source Software Archive

Member "cbatticon-1.6.13/Makefile" (27 Apr 2022, 3288 Bytes) of package /linux/privat/cbatticon-1.6.13.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "Makefile": 1.6.11_vs_1.6.12.

    1 # options
    2 
    3 ### verbosity: 0 for off, 1 for on (default: off)
    4 V = 0
    5 
    6 ### whether to link against gtk3 or gtk2 (default: gtk3)
    7 WITH_GTK3 = 1
    8 
    9 ### libnotify support: 0 for off, 1 for on (default: on)
   10 WITH_NOTIFY = 1
   11 
   12 # programs
   13 
   14 CC ?= gcc
   15 MSGFMT = msgfmt
   16 PKG_CONFIG ?= pkg-config
   17 RM = rm -f
   18 GETTEXT=xgettext
   19 INSTALL = install
   20 INSTALL_BIN = $(INSTALL) -m755
   21 INSTALL_DATA = $(INSTALL) -m644
   22 
   23 # variables
   24 
   25 PACKAGE_NAME = cbatticon
   26 VERSION = $(shell grep CBATTICON_VERSION_NUMBER cbatticon.c | awk '{print $$3}')
   27 PREFIX ?= /usr
   28 BINDIR = $(PREFIX)/bin
   29 DOCDIR = $(PREFIX)/share/doc/$(PACKAGE_NAME)-$(VERSION)
   30 MANDIR = $(PREFIX)/share/man/man1
   31 NLSDIR = $(PREFIX)/share/locale
   32 LANGUAGES = bs de el es fr he hr id ja pt_BR ru sk sr tr zh_TW
   33 
   34 BIN = $(PACKAGE_NAME)
   35 SOURCEFILES := $(wildcard *.c)
   36 OBJECTS := $(patsubst %.c,%.o,$(SOURCEFILES))
   37 SOURCECATALOGS := $(wildcard *.po)
   38 TRANSLATIONS := $(patsubst %.po,%.mo,$(SOURCECATALOGS))
   39 
   40 # flags and libs
   41 
   42 ifeq ($(V),0)
   43 VERBOSE=@
   44 else
   45 VERBOSE=
   46 endif
   47 
   48 ifeq ($(WITH_NOTIFY),1)
   49 CPPFLAGS += -DWITH_NOTIFY
   50 endif
   51 CPPFLAGS += -DNLSDIR=\"$(NLSDIR)\"
   52 
   53 CFLAGS ?= -O2
   54 CFLAGS += -Wall -Wno-deprecated-declarations -std=c99
   55 CFLAGS += $(shell $(PKG_CONFIG) --cflags $(PKG_DEPS))
   56 
   57 ifeq ($(WITH_GTK3), 0)
   58 PKG_DEPS = gtk+-2.0
   59 else
   60 PKG_DEPS = gtk+-3.0
   61 endif
   62 
   63 ifeq ($(WITH_NOTIFY),1)
   64 PKG_DEPS += libnotify
   65 endif
   66 
   67 LIBS += $(shell $(PKG_CONFIG) --libs $(PKG_DEPS)) -lm
   68 
   69 # targets
   70 
   71 all: $(BIN) $(TRANSLATIONS)
   72 
   73 $(BIN): $(OBJECTS)
   74 	@echo -e '\033[0;35mLinking executable $@\033[0m'
   75 	$(VERBOSE) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
   76 
   77 $(OBJECTS): $(SOURCEFILES)
   78 	@echo -e '\033[0;32mBuilding object $@\033[0m'
   79 	$(VERBOSE) $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
   80 
   81 $(TRANSLATIONS): %.mo: %.po
   82 	@echo -e '\033[0;36mCompiling messages catalog $@\033[0m'
   83 	$(VERBOSE) $(MSGFMT) -o $@ $<
   84 
   85 install: $(BIN) $(TRANSLATIONS)
   86 	@echo -e '\033[0;33mInstalling $(PACKAGE_NAME)\033[0m'
   87 	$(VERBOSE) $(INSTALL) -d "$(DESTDIR)$(BINDIR)"
   88 	$(VERBOSE) $(INSTALL_BIN) $(BIN) "$(DESTDIR)$(BINDIR)"/
   89 	$(VERBOSE) $(INSTALL) -d "$(DESTDIR)$(DOCDIR)"
   90 	$(VERBOSE) $(INSTALL_DATA) README "$(DESTDIR)$(DOCDIR)"/
   91 	$(VERBOSE) $(INSTALL) -d "$(DESTDIR)$(MANDIR)"
   92 	$(VERBOSE) $(INSTALL_DATA) cbatticon.1 "$(DESTDIR)$(MANDIR)"/
   93 	$(VERBOSE) for language in $(LANGUAGES); \
   94 	do \
   95 		$(INSTALL) -d "$(DESTDIR)$(NLSDIR)"/$$language/LC_MESSAGES; \
   96 		$(INSTALL_DATA) $$language.mo "$(DESTDIR)$(NLSDIR)"/$$language/LC_MESSAGES/$(PACKAGE_NAME).mo; \
   97 	done
   98 
   99 uninstall:
  100 	@echo -e '\033[0;33mUninstalling $(PACKAGE_NAME)\033[0m'
  101 	$(VERBOSE) $(RM) "$(DESTDIR)$(BINDIR)"/$(BIN)
  102 	$(VERBOSE) $(RM) "$(DESTDIR)$(DOCDIR)"/README
  103 	$(VERBOSE) $(RM) "$(DESTDIR)$(MANDIR)"/cbatticon.1
  104 	$(VERBOSE) for language in $(LANGUAGES); \
  105 	do \
  106 		$(VERBOSE) $(RM) "$(DESTDIR)$(NLSDIR)"/$$language/LC_MESSAGES/$(PACKAGE_NAME).mo; \
  107 	done
  108 
  109 clean:
  110 	@echo -e '\033[0;33mCleaning up source directory\033[0m'
  111 	$(VERBOSE) $(RM) $(BIN) $(OBJECTS) $(TRANSLATIONS)
  112 
  113 translation-refresh-pot:
  114 	$(VERBOSE) $(GETTEXT) --default-domain=$(PACKAGE_NAME) --add-comments \
  115 		--keyword=_ --keyword=N_ --keyword=g_dngettext:2,3 $(SOURCEFILES) \
  116 		--output=$(PACKAGE_NAME).pot
  117 
  118 translation-status:
  119 	$(VERBOSE) for catalog in $(SOURCECATALOGS); \
  120 	do \
  121 		$(MSGFMT) -v --statistics -o /dev/null $$catalog; \
  122 	done
  123 
  124 .PHONY: install uninstall clean translation-status