Make build process more verbose
This commit is contained in:
parent
abdd0671f7
commit
9a9d6bb0dc
77
Makefile
77
Makefile
|
@ -134,62 +134,51 @@ bin: $(BIN)
|
|||
$(OBJ): $(HDR) config.mk
|
||||
|
||||
.o:
|
||||
@echo LD $@
|
||||
@$(LD) -o $@ $< util.a $(LDFLAGS)
|
||||
$(LD) -o $@ $< util.a $(LDFLAGS)
|
||||
|
||||
.c.o:
|
||||
@echo CC $<
|
||||
@$(CC) -c -o $@ $< $(CFLAGS)
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
util.a: $(LIB)
|
||||
@echo AR $@
|
||||
@$(AR) -r -c $@ $?
|
||||
@ranlib $@
|
||||
$(AR) -r -c $@ $?
|
||||
ranlib $@
|
||||
|
||||
install: all
|
||||
@echo installing executables to $(DESTDIR)$(PREFIX)/bin
|
||||
@mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
@cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
|
||||
@cd $(DESTDIR)$(PREFIX)/bin && chmod 755 $(BIN)
|
||||
@echo installing manual pages to $(DESTDIR)$(MANPREFIX)/man1
|
||||
@mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||
@for m in $(MAN); do sed "s/VERSION/$(VERSION)/g" < "$$m" > $(DESTDIR)$(MANPREFIX)/man1/"$$m"; done
|
||||
@cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN)
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
|
||||
cd $(DESTDIR)$(PREFIX)/bin && chmod 755 $(BIN)
|
||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||
for m in $(MAN); do sed "s/VERSION/$(VERSION)/g" < "$$m" > $(DESTDIR)$(MANPREFIX)/man1/"$$m"; done
|
||||
cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN)
|
||||
|
||||
uninstall:
|
||||
@echo removing executables from $(DESTDIR)$(PREFIX)/bin
|
||||
@cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)
|
||||
@echo removing manual pages from $(DESTDIR)$(MANPREFIX)/man1
|
||||
@cd $(DESTDIR)$(MANPREFIX)/man1 && rm -f $(MAN)
|
||||
cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)
|
||||
cd $(DESTDIR)$(MANPREFIX)/man1 && rm -f $(MAN)
|
||||
|
||||
dist: clean
|
||||
@echo creating dist tarball
|
||||
@mkdir -p sbase-$(VERSION)
|
||||
@cp -r LICENSE Makefile README TODO config.mk $(SRC) $(MAN) util $(HDR) sbase-$(VERSION)
|
||||
@tar -cf sbase-$(VERSION).tar sbase-$(VERSION)
|
||||
@gzip sbase-$(VERSION).tar
|
||||
@rm -rf sbase-$(VERSION)
|
||||
mkdir -p sbase-$(VERSION)
|
||||
cp -r LICENSE Makefile README TODO config.mk $(SRC) $(MAN) util $(HDR) sbase-$(VERSION)
|
||||
tar -cf sbase-$(VERSION).tar sbase-$(VERSION)
|
||||
gzip sbase-$(VERSION).tar
|
||||
rm -rf sbase-$(VERSION)
|
||||
|
||||
sbase-box: $(SRC) util.a
|
||||
@echo creating box binary
|
||||
@mkdir -p build
|
||||
@cp $(HDR) build
|
||||
@for f in $(SRC); do sed "s/^main(/`basename $$f .c`_&/" < $$f > build/$$f; done
|
||||
@echo '#include <libgen.h>' > build/$@.c
|
||||
@echo '#include <stdio.h>' >> build/$@.c
|
||||
@echo '#include <stdlib.h>' >> build/$@.c
|
||||
@echo '#include <string.h>' >> build/$@.c
|
||||
@echo '#include "util.h"' >> build/$@.c
|
||||
@for f in $(SRC); do echo "int `basename $$f .c`_main(int, char **);" >> build/$@.c; done
|
||||
@echo 'int main(int argc, char *argv[]) { char *s = basename(argv[0]); if(!strcmp(s,"sbase-box")) { argc--; argv++; s = basename(argv[0]); } if(0) ;' >> build/$@.c
|
||||
@for f in $(SRC); do echo "else if(!strcmp(s, \"`basename $$f .c`\")) return `basename $$f .c`_main(argc, argv);" >> build/$@.c; done
|
||||
@echo 'else {' >> build/$@.c
|
||||
@for f in $(SRC); do echo "printf(\"`basename $$f .c`\"); putchar(' ');" >> build/$@.c; done
|
||||
@echo "putchar(0xa); }; return 0; }" >> build/$@.c
|
||||
@echo LD $@
|
||||
@$(LD) -o $@ build/*.c util.a $(CFLAGS) $(LDFLAGS)
|
||||
@rm -r build
|
||||
mkdir -p build
|
||||
cp $(HDR) build
|
||||
for f in $(SRC); do sed "s/^main(/`basename $$f .c`_&/" < $$f > build/$$f; done
|
||||
echo '#include <libgen.h>' > build/$@.c
|
||||
echo '#include <stdio.h>' >> build/$@.c
|
||||
echo '#include <stdlib.h>' >> build/$@.c
|
||||
echo '#include <string.h>' >> build/$@.c
|
||||
echo '#include "util.h"' >> build/$@.c
|
||||
for f in $(SRC); do echo "int `basename $$f .c`_main(int, char **);" >> build/$@.c; done
|
||||
echo 'int main(int argc, char *argv[]) { char *s = basename(argv[0]); if(!strcmp(s,"sbase-box")) { argc--; argv++; s = basename(argv[0]); } if(0) ;' >> build/$@.c
|
||||
for f in $(SRC); do echo "else if(!strcmp(s, \"`basename $$f .c`\")) return `basename $$f .c`_main(argc, argv);" >> build/$@.c; done
|
||||
echo 'else {' >> build/$@.c
|
||||
for f in $(SRC); do echo "printf(\"`basename $$f .c`\"); putchar(' ');" >> build/$@.c; done
|
||||
echo "putchar(0xa); }; return 0; }" >> build/$@.c
|
||||
$(LD) -o $@ build/*.c util.a $(CFLAGS) $(LDFLAGS)
|
||||
rm -r build
|
||||
|
||||
clean:
|
||||
@echo cleaning
|
||||
@rm -f $(BIN) $(OBJ) $(LIB) util.a sbase-box sbase-$(VERSION).tar.gz
|
||||
|
|
10
config.mk
10
config.mk
|
@ -9,11 +9,5 @@ MANPREFIX = $(PREFIX)/share/man
|
|||
#CC = musl-gcc
|
||||
LD = $(CC)
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE
|
||||
CFLAGS = -g -std=c99 -Wall -pedantic $(CPPFLAGS)
|
||||
LDFLAGS = -g
|
||||
|
||||
#CC = tcc
|
||||
#LD = $(CC)
|
||||
#CPPFLAGS = -D_POSIX_C_SOURCE=200112L
|
||||
#CFLAGS = -Os -Wall $(CPPFLAGS) -D_GNU_SOURCE
|
||||
#LDFLAGS =
|
||||
CFLAGS = -std=c99 -Wall -pedantic $(CPPFLAGS)
|
||||
LDFLAGS = -s
|
||||
|
|
Loading…
Reference in New Issue
Block a user