htpp

htrdr-image post-processing
git clone git://git.meso-star.fr/htpp.git
Log | Files | Refs | README | LICENSE

Makefile (3048B)


      1 # Copyright (C) 2018-2020, 2023 |Méso|Star> (contact@meso-star.com)
      2 # Copyright (C) 2018, 2019 Centre National de la Recherche Scientifique
      3 # Copyright (C) 2018, 2019 Université Paul Sabatier
      4 #
      5 # This program is free software: you can redistribute it and/or modify
      6 # it under the terms of the GNU General Public License as published by
      7 # the Free Software Foundation, either version 3 of the License, or
      8 # (at your option) any later version.
      9 #
     10 # This program is distributed in the hope that it will be useful,
     11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     13 # GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public License
     16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
     17 
     18 .POSIX:
     19 .SUFFIXES: # Clean up default inference rules
     20 
     21 include config.mk
     22 
     23 ################################################################################
     24 # Library building
     25 ################################################################################
     26 SRC = src/htpp.c
     27 OBJ = $(SRC:.c=.o)
     28 DEP = $(SRC:.c=.d)
     29 
     30 build_library: .config $(DEP)
     31 	@$(MAKE) -fMakefile $$(for i in $(DEP); do echo -f $${i}; done) htpp
     32 
     33 $(DEP) $(OBJ): config.mk
     34 
     35 htpp: $(OBJ)
     36 	$(CC) $(CFLAGS) $(DPDC_CFLAGS) -o $@ $(OBJ) $(LDFLAGS) $(DPDC_LIBS)
     37 
     38 .config: config.mk
     39 	@if ! $(PKG_CONFIG) --atleast-version $(SCMAP_VERSION) scmap; then \
     40 	  echo "scmap $(SCMAP_VERSION) not found" >&2; exit 1; fi
     41 	@if ! $(PKG_CONFIG) --atleast-version $(RSYS_VERSION) rsys; then \
     42 	  echo "rsys $(RSYS_VERSION) not found" >&2; exit 1; fi
     43 	@echo "config done" > $@
     44 
     45 src/htpp.d: src/htpp_version.h
     46 
     47 src/htpp_version.h: src/htpp_version.h.in config.mk
     48 	sed -e 's#@VERSION_MAJOR@#$(VERSION_MAJOR)#g' \
     49 	    -e 's#@VERSION_MINOR@#$(VERSION_MINOR)#g' \
     50 	    -e 's#@VERSION_PATCH@#$(VERSION_PATCH)#g' \
     51 	    src/htpp_version.h.in > $@
     52 
     53 .SUFFIXES: .c .d .o
     54 .c.d:
     55 	@$(CC) $(CFLAGS) $(DPDC_CFLAGS) -MM -MT "$(@:.d=.o) $@" $< -MF $@
     56 
     57 .c.o:
     58 	$(CC) $(CFLAGS) $(DPDC_CFLAGS) -c $< -o $@
     59 
     60 ################################################################################
     61 # Installation
     62 ################################################################################
     63 install: build_library
     64 	@$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/bin" htpp
     65 	@$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/doc/htpp" COPYING README.md
     66 	@$(SHELL) make.sh install "$(DESTDIR)$(PREFIX)/share/man/man1" htpp.1
     67 
     68 uninstall:
     69 	rm -f "$(DESTDIR)$(PREFIX)/bin/htpp"
     70 	rm -f "$(DESTDIR)$(PREFIX)/share/doc/htpp/COPYING"
     71 	rm -f "$(DESTDIR)$(PREFIX)/share/doc/htpp/README.md"
     72 	rm -f "$(DESTDIR)$(PREFIX)/share/man/man1/htpp.1"
     73 
     74 ################################################################################
     75 # Miscellaneous targets
     76 ################################################################################
     77 all: build_library
     78 
     79 clean:
     80 	rm -f $(OBJ) htpp .config
     81 
     82 distclean: clean
     83 	rm -f $(DEP) src/htpp_version.h
     84 
     85 lint:
     86 	shellcheck -o all make.sh
     87 	mandoc -Tlint -Wall htpp.1 || [ $$? -le 1 ]