Makefile (2027B)
1 # surf - simple browser 2 # See LICENSE file for copyright and license details. 3 .POSIX: 4 5 include config.mk 6 7 SRC = surf.c 8 CSRC = common.c 9 WEBEXTSRC = libsurf-webext.c 10 OBJ = $(SRC:.c=.o) 11 COBJ = $(CSRC:.c=.o) 12 WEBEXTOBJ = $(WEBEXTSRC:.c=.o) 13 14 all: options libsurf-webext.so surf 15 16 options: 17 @echo surf build options: 18 @echo "CC = $(CC)" 19 @echo "CFLAGS = $(SURFCFLAGS) $(CFLAGS)" 20 @echo "WEBEXTCFLAGS = $(WEBEXTCFLAGS) $(CFLAGS)" 21 @echo "LDFLAGS = $(LDFLAGS)" 22 23 .c.o: 24 $(CC) $(SURFCFLAGS) $(CFLAGS) -c $< 25 26 config.h: 27 cp config.def.h $@ 28 29 $(OBJ): config.h common.h config.mk 30 $(COBJ): config.h common.h config.mk 31 $(WEBEXTOBJ): config.h common.h config.mk 32 33 $(WEBEXTOBJ): $(WEBEXTSRC) 34 $(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WEBEXTSRC) 35 36 libsurf-webext.so: $(WEBEXTOBJ) $(COBJ) 37 $(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ \ 38 $(WEBEXTOBJ) $(COBJ) $(WEBEXTLIBS) 39 40 surf: $(OBJ) $(COBJ) 41 $(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(COBJ) $(LIBS) 42 43 clean: 44 rm -f surf $(OBJ) $(COBJ) 45 rm -f libsurf-webext.so $(WEBEXTOBJ) 46 47 distclean: clean 48 rm -f config.h surf-$(VERSION).tar.gz 49 50 dist: distclean 51 mkdir -p surf-$(VERSION) 52 cp -R LICENSE Makefile config.mk config.def.h README \ 53 surf-open.sh arg.h TODO.md surf.png \ 54 surf.1 $(SRC) $(WEBEXTSRC) surf-$(VERSION) 55 tar -cf surf-$(VERSION).tar surf-$(VERSION) 56 gzip surf-$(VERSION).tar 57 rm -rf surf-$(VERSION) 58 59 install: all 60 mkdir -p $(DESTDIR)$(PREFIX)/bin 61 cp -f surf $(DESTDIR)$(PREFIX)/bin 62 chmod 755 $(DESTDIR)$(PREFIX)/bin/surf 63 mkdir -p $(DESTDIR)$(LIBDIR) 64 cp -f libsurf-webext.so $(DESTDIR)$(LIBDIR) 65 chmod 644 $(DESTDIR)$(LIBDIR)/libsurf-webext.so 66 mkdir -p $(DESTDIR)$(MANPREFIX)/man1 67 sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1 68 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1 69 70 uninstall: 71 rm -f $(DESTDIR)$(PREFIX)/bin/surf 72 rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1 73 rm -f $(DESTDIR)$(LIBDIR)/libsurf-webext.so 74 - rmdir $(DESTDIR)$(LIBDIR) 75 76 .SUFFIXES: .so .o .c 77 .PHONY: all options clean-dist clean dist install uninstall