star-build

Automation tool for project installation
git clone git://git.meso-star.com/star-build.git
Log | Files | Refs | README | LICENSE

noweb.mk.in (2120B)


      1 # Copyright (C) 2023-2026 |Méso|Star> (contact@meso-star.com)
      2 #
      3 # This file is part of Star-Build.
      4 #
      5 # Star-Build 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 # Star-Build 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 Star-Build. If not, see <http://www.gnu.org/licenses/>.
     17 
     18 # Configuration macros
     19 NOWEB_TAG=@TAG@
     20 NOWEB_URL_ONLINE=https://github.com/nrnrnr/noweb
     21 NOWEB_URL_OFFLINE=$(MIRROR)/noweb
     22 NOWEB_URL = $(NOWEB_URL_$(NETWORK))
     23 
     24 # Helper macros
     25 NOWEB_DIR=$(CACHE)/noweb/$(NOWEB_TAG)
     26 NOWEB_MAKE=$(MAKE)\
     27  BIN="$${prefix}/bin"\
     28  LIB="$${prefix}/lib"\
     29  MAN="$${prefix}/share/man"\
     30  TEXINPUTS="$${prefix}/share/tex/"\
     31  ELISP=/dev/null
     32 
     33 noweb: build_noweb
     34 	@prefix=$$(cat .prefix) &&\
     35 	cd -- "$(NOWEB_DIR)/src" &&\
     36 	$(NOWEB_MAKE) install
     37 
     38 build_noweb: $(NOWEB_DIR) prefix patch_noweb
     39 	@prefix=$$(cat .prefix) &&\
     40 	cd -- "$(NOWEB_DIR)/src" &&\
     41 	./awkname awk &&\
     42 	$(NOWEB_MAKE) boot &&\
     43 	$(NOWEB_MAKE) all
     44 
     45 patch_noweb: $(NOWEB_DIR)
     46 	@prefix=$$(cat .prefix) &&\
     47 	cd -- "$(NOWEB_DIR)/src" &&\
     48 	( rm Makefile && sed -n '/^Makefile:/{:a;n;/^\t/ba;};p' > Makefile ) < Makefile
     49 
     50 $(NOWEB_DIR):
     51 	@git clone --branch "$(NOWEB_TAG)" --depth 1 "$(NOWEB_URL)" "$@"
     52 
     53 clean_noweb:
     54 	if [ -d "$(NOWEB_DIR)/src" ]; then\
     55 		cd -- "$(NOWEB_DIR)/src" && $(MAKE) clean;\
     56 	fi
     57 
     58 uninstall_noweb: fetch_noweb prefix
     59 	@prefix=$$(cat .prefix) &&\
     60 	cd -- "$(NOWEB_DIR)/src" &&\
     61 	$(NOWEB_MAKE) uninstall &&\
     62 	rm -f "$${prefix}/lib/nwmktemp"
     63 
     64 mirror_noweb:
     65 	repo=$(MIRROR)/noweb &&\
     66 	rm -rf "$${repo}" &&\
     67 	git clone --bare --branch "$(NOWEB_TAG)" $(MIRROR_GIT_OPT) \
     68 	  "$(NOWEB_URL)" "$${repo}"
     69 
     70 clean_all: clean_noweb
     71 install_all: noweb
     72 uninstall_all: uninstall_noweb
     73 mirror_all: mirror_noweb