fix(Makefile): minor tweaks

This commit is contained in:
Tom MTT. 2022-12-11 14:38:36 +01:00
parent fbcf5b1464
commit 5c93649473
4 changed files with 28 additions and 17 deletions

1
.gitignore vendored
View file

@ -4,5 +4,6 @@ cosmopolitan
feuille feuille
feuille.com feuille.com
feuille.com.dbg
cgi/feuille.cgi cgi/feuille.cgi

View file

@ -10,18 +10,21 @@ TARGET$(COSMO) = feuille
SRC = feuille.c util.c server.c bin.c SRC = feuille.c util.c server.c bin.c
OBJ = $(SRC:%.c=%.o) OBJ = $(SRC:%.c=%.o)
all: $(TARGET) feuille.1 cgi all: $(TARGET) feuille.1 cgi
run: $(TARGET) run: $(TARGET)
./$(TARGET) ./$(TARGET)
clean: clean:
@printf "%-8s $(OBJ)\n" "rm" @printf "%-8s $(OBJ)\n" "rm"
@rm -f $(OBJ) @rm -f $(OBJ)
distclean: distclean:
@printf "%-8s feuille feuille.com $(OBJ)\n" "rm" @printf "%-8s feuille feuille.com feuille.com.dbg $(OBJ)\n" "rm"
@rm -f feuille feuille.com $(OBJ) @rm -f feuille feuille.com feuille.com.dbg $(OBJ)
install: $(TARGET) feuille.1 install: $(TARGET) feuille.1
@echo "installing executable file to $(PREFIX)/bin" @echo "installing executable file to $(PREFIX)/bin"
@ -34,26 +37,25 @@ install: $(TARGET) feuille.1
@cp -f feuille.1 $(MAN)/man1 @cp -f feuille.1 $(MAN)/man1
@chmod 644 $(MAN)/man1/feuille.1 @chmod 644 $(MAN)/man1/feuille.1
uninstall: $(PREFIX)/bin/$(TARGET) $(MAN)/man1/feuille.1 uninstall:
@echo "removing executable file from $(PREFIX)/bin" @echo "removing executable file from $(PREFIX)/bin"
@rm -f "$(PREFIX)/bin/$(TARGET)" @rm -f "$(PREFIX)/bin/$(TARGET)"
@echo "removing manpage from $(MAN)/man1" @echo "removing manpage from $(MAN)/man1"
@rm -f $(MAN)/man1/feuille.1 @rm -f $(MAN)/man1/feuille.1
feuille.1: feuille.1.md config.mk
@printf "%-8s feuille.1.md -o feuille.1\n" "pandoc"
@sed "s/{VERSION}/$(VERSION)/g" feuille.1.md | pandoc -s -t man -o feuille.1
# manpage
feuille.1: feuille.1.md config.mk
@printf "%-8s $@.md -o $@\n" "pandoc"
@sed "s/{VERSION}/$(VERSION)/g" $@.md | pandoc -s -t man -o $@
# standard libc
feuille: $(OBJ) feuille: $(OBJ)
@printf "%-8s $(OBJ) -o feuille\n" "$(CC)" @printf "%-8s $(OBJ) -o $@\n" "$(CC)"
@$(CC) $(OBJ) -o feuille $(LDFLAGS) @$(CC) $(OBJ) -o $@ $(LDFLAGS)
# cosmopolitan libc # cosmopolitan libc
feuille.com: cosmopolitan feuille
@printf "%-8s feuille -o feuille.com\n" "objcopy"
@objcopy -S -O binary feuille feuille.com
cosmopolitan: cosmopolitan:
@if [ ! -d cosmopolitan ]; then \ @if [ ! -d cosmopolitan ]; then \
printf "%-8s https://justine.lol/cosmopolitan/cosmopolitan-amalgamation-2.2.zip\n" "curl" ;\ printf "%-8s https://justine.lol/cosmopolitan/cosmopolitan-amalgamation-2.2.zip\n" "curl" ;\
@ -65,6 +67,14 @@ cosmopolitan:
rm -rf cosmopolitan-amalgamation-* ;\ rm -rf cosmopolitan-amalgamation-* ;\
fi fi
feuille.com.dbg: $(OBJ)
@printf "%-8s $(OBJ) -o $@\n" "$(CC)"
@$(CC) $(OBJ) -o $@ $(LDFLAGS)
feuille.com: cosmopolitan feuille.com.dbg
@printf "%-8s $@.dbg -o $@\n" "objcopy"
@objcopy -S -O binary $@.dbg $@
# CGI script # CGI script
ADDR = 127.0.0.1 ADDR = 127.0.0.1
PORT = 9999 PORT = 9999
@ -73,9 +83,9 @@ cgi: cgi/feuille.cgi
cgi/feuille.cgi: cgi/feuille.cgi.c cgi/feuille.cgi: cgi/feuille.cgi.c
@printf "%-8s cgi/feuille.cgi.c -o cgi/feuille.cgi\n" "$(CC)" @printf "%-8s cgi/feuille.cgi.c -o cgi/feuille.cgi\n" "$(CC)"
@$(CC) cgi/feuille.cgi.c -o cgi/feuille.cgi -std=c99 -O3 -static -Wall -Wextra \ @$(CC) $@.c -o $@ -std=c99 -O3 -static -Wall -Wextra \
-DADDR=\"$(ADDR)\" -DPORT=$(PORT) \ -DADDR=\"$(ADDR)\" -DPORT=$(PORT) \
$(INCS) $(LIBS) $(INCS) $(LIBS)
.SUFFIXES: .c .o .SUFFIXES: .c .o
.c.o: .c.o:

View file

@ -1,5 +1,5 @@
# feuille version # feuille version
VERSION = 2.1.1 VERSION = 2.1.2
# paths (customize them to fit your system) # paths (customize them to fit your system)
PREFIX = /usr/local PREFIX = /usr/local

View file

@ -14,7 +14,7 @@
. ftr VB CB . ftr VB CB
. ftr VBI CBI . ftr VBI CBI
.\} .\}
.TH "feuille" "1" "November 2022" "feuille 2.1.1" "" .TH "feuille" "1" "November 2022" "feuille 2.1.2" ""
.hy .hy
.SH NAME .SH NAME
.PP .PP