logo

badwolf

minimalist and privacy-oriented web browser based on WebKitGTK git clone https://hacktivis.me/git/badwolf.git

Makefile (4114B)


  1. # SPDX-FileCopyrightText: 2019-2022 Badwolf Authors <https://hacktivis.me/projects/badwolf>
  2. # SPDX-License-Identifier: BSD-3-Clause
  3. # POSIX-ish Makefile with extensions common to *BSD and GNU such as:
  4. # - Usage of backticks for shell evaluation
  5. # - Usage of ?= for defining variables when not already defined
  6. # - Usage of += for appending to a variable
  7. include config.mk
  8. SRCS = bookmarks.c fmt.c fmt_test.c uri.c uri_test.c keybindings.c downloads.c badwolf.c
  9. OBJS = bookmarks.o fmt.o uri.o keybindings.o downloads.o badwolf.o
  10. OBJS_test = fmt_test.o uri_test.o bookmarks_test.o
  11. EXE = badwolf
  12. EXE_test = fmt_test uri_test bookmarks_test
  13. TRANS = fr.mo pt_BR.mo tr.mo de.mo vi.mo
  14. TRANS_MAN = badwolf.fr.1
  15. DOCS = usr.bin.badwolf README.md KnowledgeBase.md interface.md
  16. GETTEXT_OPTS = --copyright-holder="Badwolf Authors <https://hacktivis.me/projects/badwolf>" --package-name="$(PACKAGE)" --package-version="$(VERSION_FULL)" --msgid-bugs-address="contact+badwolf-msgid@hacktivis.me"
  17. all: config.mk $(EXE) $(TRANS) po/messages.pot $(TRANS_MAN) po/manpage.pot
  18. config.mk: configure
  19. @echo "Error: You need to execute ./configure before running make"
  20. @exit 1
  21. icons: $(ICON_SIZES)
  22. icons/hicolor/scalable/apps/badwolf.svg: badwolf.svg
  23. mkdir -p icons/hicolor/scalable/apps
  24. scour --no-line-breaks --enable-id-stripping --remove-metadata $< $@
  25. icons/hicolor/%/apps/badwolf.png: icons/hicolor/scalable/apps/badwolf.svg
  26. mkdir -p `dirname $@`
  27. $(INKSCAPE) `echo $@ | cut -d/ -f3 | ./icons_size.sh` $< -o $@
  28. po/messages.pot: $(SRCS) po/pot_license.ed
  29. xgettext --keyword=_ --language=C --from-code=UTF-8 -o $@ --add-comments --sort-output --foreign-user $(GETTEXT_OPTS) $(SRCS)
  30. $(ED) -s $@ <po/pot_license.ed
  31. po/manpage.pot: badwolf.1 po/pot_license.ed
  32. po4a-gettextize --format man -M utf-8 --master badwolf.1 $(GETTEXT_OPTS) --po $@
  33. $(ED) -s $@ <po/pot_license.ed
  34. po/%_man.po: po/manpage.pot badwolf.1
  35. po4a-updatepo --format man -M utf-8 --master badwolf.1 --msgmerge-opt '--update' $(GETTEXT_OPTS) --po $@
  36. po/%.po: po/messages.pot
  37. msgmerge --update --backup=off $@ $<
  38. ${TRANS}: po/${@:.mo=.po}
  39. mkdir -p locale/${@:.mo=}/LC_MESSAGES
  40. $(MSGFMT) -o locale/${@:.mo=}/LC_MESSAGES/$(PACKAGE).mo po/${@:.mo=.po}
  41. badwolf.fr.1: po/fr_man.po badwolf.1
  42. po4a-translate --format man -M utf-8 --master badwolf.1 --po po/fr_man.po --localized $@
  43. badwolf: $(OBJS)
  44. $(CC) -std=c11 -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
  45. .c:
  46. $(CC) -std=c11 $(CFLAGS) $(LDFLAGS) $(LIBS) -o $@ $<
  47. .c.o:
  48. $(CC) -std=c11 $(CFLAGS) -c -o $@ $<
  49. uri_test: uri.o uri_test.o
  50. $(CC) -std=c11 -o $@ uri.o uri_test.o $(LDFLAGS) $(LIBS)
  51. fmt_test: fmt.o fmt_test.o
  52. $(CC) -std=c11 -o $@ fmt.o fmt_test.o $(LDFLAGS) $(LIBS)
  53. bookmarks_test: bookmarks.o bookmarks_test.o
  54. $(CC) -std=c11 -o $@ bookmarks.o bookmarks_test.o $(LDFLAGS) $(LIBS)
  55. .PHONY: test
  56. test: $(EXE_test)
  57. $(DBG) ./uri_test
  58. $(DBG) ./fmt_test
  59. $(DBG) ./bookmarks_test
  60. .PHONY: lint
  61. lint:
  62. $(MANDOC) -Tlint -Wunsupp,error,warning ./badwolf.1 $(TRANS_MAN)
  63. $(SHELLCHECK) ./configure
  64. $(FLAWFINDER) .
  65. $(REUSE) lint
  66. .PHONY: install
  67. install: all
  68. mkdir -p $(DESTDIR)$(BINDIR)
  69. cp -p badwolf $(DESTDIR)$(BINDIR)/
  70. mkdir -p $(DESTDIR)$(MANDIR)/man1
  71. cp -p badwolf.1 $(DESTDIR)$(MANDIR)/man1/
  72. # TODO: use $TRANS_MAN
  73. mkdir -p $(DESTDIR)$(MANDIR)/fr/man1
  74. cp -p badwolf.fr.1 $(DESTDIR)$(MANDIR)/fr/man1/badwolf.1
  75. mkdir -p $(DESTDIR)$(DATADIR)/locale
  76. cp -r locale/ $(DESTDIR)$(DATADIR)/
  77. cp interface.css $(DESTDIR)$(DATADIR)/
  78. mkdir -p $(DESTDIR)$(APPSDIR)
  79. cp -p badwolf.desktop $(DESTDIR)$(APPSDIR)/
  80. mkdir -p $(DESTDIR)$(DOCDIR)
  81. cp -p $(DOCS) $(DESTDIR)$(DOCDIR)/
  82. mkdir -p $(DESTDIR)$(PREFIX)/share
  83. cp -r icons $(DESTDIR)$(PREFIX)/share/
  84. @printf '\nNote: An example AppArmor profile has been installed at '$(DOCDIR)/usr.bin.badwolf'\n'
  85. .PHONY: clean
  86. clean:
  87. rm -fr locale $(OBJS) $(OBJS_test) $(EXE) $(EXE_test)
  88. .PHONY: distclean
  89. distclean: clean
  90. rm -fr config.mk
  91. .PHONY: AUTHORS
  92. AUTHORS: .git
  93. git log --use-mailmap --format='format:%aN <%aE>' --date='format:%Y' | sort | uniq > AUTHORS
  94. format: *.c *.h
  95. clang-format -style=file -assume-filename=.clang-format -i *.c *.h