diff options
author | Andreas Fankhauser (@tux-six) | 2022-07-05 03:20:13 +0200 |
---|---|---|
committer | Andreas Fankhauser (@tux-six) | 2022-07-05 03:20:13 +0200 |
commit | 2eb3a5adf2fd55f21dd9dfa20b423883a6afce12 (patch) | |
tree | d171a9c97d644cafef67fdde361ff93da65d6dd3 /Makefile | |
parent | d2c0bed52d0a293d5541940dedbfe2b5c9afd2c8 (diff) | |
download | bulk-ln-2eb3a5adf2fd55f21dd9dfa20b423883a6afce12.zip bulk-ln-2eb3a5adf2fd55f21dd9dfa20b423883a6afce12.tar.gz |
Enhance configure script and other cleanup
- Get rid of Makefile by using configure script to create it fully
- Enhance automation of PROJECT_VERSION
- Fold README and doc/INSTALL into one file
- Try to be more POSIX-like in scripts
- Rename 'package' target to 'dist'
- Drop usage of 'bool'
- Count dirs also while dry-run
- Use dbl quotes in some log msgs
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/Makefile b/Makefile deleted file mode 100644 index 86b113f..0000000 --- a/Makefile +++ /dev/null @@ -1,91 +0,0 @@ - -CC=gcc -TAR=tar -MKDIRS=mkdir -p -TOOLS=lxGcc64 - -# See "./configure" -PREFIX=/usr/local -EXEC_PREFIX=$(PREFIX) -EXEC_SUFFIX= -BINDIR=$(EXEC_PREFIX)/bin - -ifndef PROJECT_VERSION - # We just provide a primitive version string so we can see which build - # we're using while debugging. For a release we will override the version - # by providing it from cli args to 'make' as in: - # make clean package PROJECT_VERSION=1.2.3 - PROJECT_VERSION=$(shell date -u +0.0.0-%Y%m%d.%H%M%S) -endif - -CFLAGS= --std=c99 \ - -Wall -Wextra -Werror -fmax-errors=3 \ - -Wno-error=unused-function -Wno-error=unused-label \ - -Wno-error=unused-variable -Wno-error=unused-parameter \ - -Wno-error=unused-const-variable \ - -Werror=implicit-fallthrough=1 \ - -Wno-error=unused-but-set-variable \ - -Wno-unused-function -Wno-unused-parameter \ - -DPROJECT_VERSION=$(PROJECT_VERSION) - -LDFLAGS= -Wl,--no-demangle,--fatal-warnings - -INCDIRS= -Isrc/bulk_ln -Isrc/common - -ifndef NDEBUG - CFLAGS := $(CFLAGS) -ggdb -O0 -g3 -else - CFLAGS := $(CFLAGS) -ffunction-sections -fdata-sections -Os "-DNDEBUG=1" - LDFLAGS := $(LDFLAGS) -Wl,--gc-sections,--as-needed -endif - - -default: link package - -.PHONY: clean -clean: - @echo "\n[INFO ] Clean" - rm -rf build dist - -.PHONY: link -link: build/bin/bulk-ln$(EXEC_SUFFIX) - -build/obj/%.o: src/%.c - @echo "\n[INFO ] Compile '$@'" - @mkdir -p $(shell dirname build/obj/$*) - $(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) - -build/bin/bulk-ln$(EXEC_SUFFIX): \ - build/obj/bulk_ln/bulk_ln.o \ - build/obj/bulk_ln/bulk_ln_main.o - @echo "\n[INFO ] Link '$@'" - @mkdir -p $(shell dirname $@) - $(CC) -o $@ $(LDFLAGS) $^ $(LIBSDIR) - -.PHONY: package -package: link - @echo "\n[INFO ] Package" - @rm -rf build/dist-* dist - @mkdir dist - @echo - @bash -c 'if [[ -n `git status --porcelain` ]]; then echo "[WARN ] Worktree not clean!"; sleep 3; fi' - @# Create Executable bundle. - @rm -rf build/dist-bin && mkdir -p build/dist-bin - @cp -t build/dist-bin \ - README* - @mkdir build/dist-bin/bin - @cp -t build/dist-bin/bin \ - build/bin/*$(EXEC_SUFFIX) - @(cd build/dist-bin && find . -type f -not -name MD5SUM -exec md5sum -b {} \;) > build/MD5SUM - @mv build/MD5SUM build/dist-bin/. - @(cd build/dist-bin && $(TAR) --owner=0 --group=0 -czf ../../dist/BulkLn-$(PROJECT_VERSION)-$(TOOLS).tgz *) - @echo "\n[INFO ] DONE: Artifacts created and placed in 'dist'." - @echo - @echo See './dist/' for result. - -.PHONY: install -install: - @$(MKDIRS) "$(BINDIR)" - $(TAR) -f "$(shell ls dist/BulkLn-*-$(TOOLS).tgz)" \ - -C "$(BINDIR)" --strip-components=1 -x bin - |