pkgtools

binary package manager for zandra
git clone git://zandra.org/pkgtools
Log | Files | Refs | README | LICENSE

Makefile (968B)


      1 include config.mk
      2 
      3 .POSIX:
      4 .SUFFIXES: .c .o
      5 
      6 LIB = \
      7 	common.o  \
      8 	db.o      \
      9 	ealloc.o  \
     10 	eprintf.o \
     11 	pkg.o     \
     12 	reject.o  \
     13 	strlcat.o \
     14 	strlcpy.o
     15 
     16 SRC = \
     17 	infopkg.c    \
     18 	installpkg.c \
     19 	removepkg.c
     20 
     21 SHPROG = \
     22 	fetchpkg     \
     23 	searchpkg
     24 
     25 OBJ = $(SRC:.c=.o) $(LIB)
     26 BIN = $(SRC:.c=)
     27 
     28 all: binlib
     29 
     30 binlib: util.a
     31 	$(MAKE) bin
     32 
     33 bin: $(BIN)
     34 
     35 $(OBJ): pkg.h config.mk
     36 
     37 .o:
     38 	@echo LD $@
     39 	@$(LD) -o $@ $< util.a $(LDFLAGS)
     40 
     41 .c.o:
     42 	@echo CC $<
     43 	@$(CC) -c -o $@ $< $(CFLAGS)
     44 
     45 util.a: $(LIB)
     46 	@echo AR $@
     47 	@$(AR) -r -c $@ $(LIB)
     48 
     49 install: all
     50 	@echo installing executables to $(DESTDIR)$(PREFIX)/bin
     51 	@mkdir -p $(DESTDIR)$(PREFIX)/bin
     52 	@cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
     53 	@cp -f $(SHPROG) $(DESTDIR)$(PREFIX)/bin
     54 	@for i in $(SHPROG); do chmod 755 $(DESTDIR)$(PREFIX)/bin/$$i; done
     55 
     56 uninstall:
     57 	@echo removing executables from $(DESTDIR)$(PREFIX)/bin
     58 	@cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN) $(SHPROG)
     59 
     60 clean:
     61 	@echo cleaning
     62 	@rm -f $(BIN) $(OBJ) $(LIB) util.a