surf

surf browser, a WebKit based browser
git clone git://git.suckless.org/surf
Log | Files | Refs | README | LICENSE

Makefile (1854B)


      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 WSRC = webext-surf.c
      9 OBJ = $(SRC:.c=.o)
     10 WOBJ = $(WSRC:.c=.o)
     11 WLIB = $(WSRC:.c=.so)
     12 
     13 all: options surf $(WLIB)
     14 
     15 options:
     16 	@echo surf build options:
     17 	@echo "CC            = $(CC)"
     18 	@echo "CFLAGS        = $(SURFCFLAGS) $(CFLAGS)"
     19 	@echo "WEBEXTCFLAGS  = $(WEBEXTCFLAGS) $(CFLAGS)"
     20 	@echo "LDFLAGS       = $(LDFLAGS)"
     21 
     22 surf: $(OBJ)
     23 	$(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
     24 
     25 $(OBJ) $(WOBJ): config.h common.h config.mk
     26 
     27 config.h:
     28 	cp config.def.h $@
     29 
     30 $(OBJ): $(SRC)
     31 	$(CC) $(SURFCFLAGS) $(CFLAGS) -c $(SRC)
     32 
     33 $(WLIB): $(WOBJ)
     34 	$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $? $(WEBEXTLIBS)
     35 
     36 $(WOBJ): $(WSRC)
     37 	$(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WSRC)
     38 
     39 clean:
     40 	rm -f surf $(OBJ)
     41 	rm -f $(WLIB) $(WOBJ)
     42 
     43 distclean: clean
     44 	rm -f config.h surf-$(VERSION).tar.gz
     45 
     46 dist: distclean
     47 	mkdir -p surf-$(VERSION)
     48 	cp -R LICENSE Makefile config.mk config.def.h README \
     49 	    surf-open.sh arg.h TODO.md surf.png \
     50 	    surf.1 common.h $(SRC) $(WSRC) surf-$(VERSION)
     51 	tar -cf surf-$(VERSION).tar surf-$(VERSION)
     52 	gzip surf-$(VERSION).tar
     53 	rm -rf surf-$(VERSION)
     54 
     55 install: all
     56 	mkdir -p $(DESTDIR)$(PREFIX)/bin
     57 	cp -f surf $(DESTDIR)$(PREFIX)/bin
     58 	chmod 755 $(DESTDIR)$(PREFIX)/bin/surf
     59 	mkdir -p $(DESTDIR)$(LIBDIR)
     60 	cp -f $(WLIB) $(DESTDIR)$(LIBDIR)
     61 	for wlib in $(WLIB); do \
     62 	    chmod 644 $(DESTDIR)$(LIBDIR)/$$wlib; \
     63 	done
     64 	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
     65 	sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1
     66 	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1
     67 
     68 uninstall:
     69 	rm -f $(DESTDIR)$(PREFIX)/bin/surf
     70 	rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1
     71 	for wlib in $(WLIB); do \
     72 	    rm -f $(DESTDIR)$(LIBDIR)/$$wlib; \
     73 	done
     74 	- rmdir $(DESTDIR)$(LIBDIR)
     75 
     76 .PHONY: all options distclean clean dist install uninstall