Makefile (1500B)
1 # See LICENSE file for copyright and license details 2 # quark - simple web server 3 .POSIX: 4 5 include config.mk 6 7 COMPONENTS = connection data http queue server sock util 8 9 all: quark 10 11 connection.o: connection.c config.h connection.h data.h http.h server.h sock.h util.h config.mk 12 data.o: data.c config.h data.h http.h server.h util.h config.mk 13 http.o: http.c config.h http.h server.h util.h config.mk 14 main.o: main.c arg.h config.h server.h sock.h util.h config.mk 15 server.o: server.c config.h connection.h http.h queue.h server.h util.h config.mk 16 sock.o: sock.c config.h sock.h util.h config.mk 17 util.o: util.c config.h util.h config.mk 18 19 quark: config.h $(COMPONENTS:=.o) $(COMPONENTS:=.h) main.o config.mk 20 $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(COMPONENTS:=.o) main.o $(LDFLAGS) 21 22 config.h: 23 cp config.def.h $@ 24 25 clean: 26 rm -f quark main.o $(COMPONENTS:=.o) 27 28 dist: 29 rm -rf "quark-$(VERSION)" 30 mkdir -p "quark-$(VERSION)" 31 cp -R LICENSE Makefile arg.h config.def.h config.mk quark.1 \ 32 $(COMPONENTS:=.c) $(COMPONENTS:=.h) main.c "quark-$(VERSION)" 33 tar -cf - "quark-$(VERSION)" | gzip -c > "quark-$(VERSION).tar.gz" 34 rm -rf "quark-$(VERSION)" 35 36 install: all 37 mkdir -p "$(DESTDIR)$(PREFIX)/bin" 38 cp -f quark "$(DESTDIR)$(PREFIX)/bin" 39 chmod 755 "$(DESTDIR)$(PREFIX)/bin/quark" 40 mkdir -p "$(DESTDIR)$(MANPREFIX)/man1" 41 cp quark.1 "$(DESTDIR)$(MANPREFIX)/man1/quark.1" 42 chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/quark.1" 43 44 uninstall: 45 rm -f "$(DESTDIR)$(PREFIX)/bin/quark" 46 rm -f "$(DESTDIR)$(MANPREFIX)/man1/quark.1"