rs

FTDI serial communication program
git clone git@git.2f30.org/rs.git
Log | Files | Refs | README | LICENSE

Makefile (1118B)


      1 include config.mk
      2 
      3 .POSIX:
      4 .SUFFIXES: .c .o
      5 
      6 LIB = \
      7 	util/eprintf.o      \
      8 	util/estrtol.o
      9 
     10 SRC = rs.c
     11 
     12 OBJ = $(SRC:.c=.o) $(LIB)
     13 BIN = $(SRC:.c=)
     14 MAN = $(SRC:.c=.1)
     15 
     16 all: options binlib
     17 
     18 options:
     19 	@echo rs build options:
     20 	@echo "CFLAGS   = $(CFLAGS)"
     21 	@echo "LDFLAGS  = $(LDFLAGS)"
     22 	@echo "CC       = $(CC)"
     23 
     24 binlib: util.a
     25 	$(MAKE) bin
     26 
     27 bin: $(BIN)
     28 
     29 $(OBJ): util.h config.mk
     30 
     31 .o:
     32 	@echo LD $@
     33 	@$(LD) -o $@ $< util.a $(LDFLAGS)
     34 
     35 .c.o:
     36 	@echo CC $<
     37 	@$(CC) -c -o $@ $< $(CFLAGS)
     38 
     39 util.a: $(LIB)
     40 	@echo AR $@
     41 	@$(AR) -r -c $@ $(LIB)
     42 	@ranlib $@
     43 
     44 install: all
     45 	@echo installing executable to $(DESTDIR)$(PREFIX)/bin
     46 	@cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
     47 	@cd $(DESTDIR)$(PREFIX)/bin && chmod 755 $(BIN)
     48 	@mkdir -p $(DESTDIR)$(MANPREFIX)/man1
     49 	@echo installing manpage to $(DESTDIR)$(MANPREFIX)/man1
     50 	@cp -f rs.1 $(DESTDIR)$(MANPREFIX)/man1
     51 
     52 uninstall:
     53 	@echo removing executable from $(DESTDIR)$(PREFIX)/bin
     54 	@cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)
     55 	@echo removing manpage from $(DESTDIR)$(MANPREFIX)/man1
     56 	@cd $(DESTDIR)$(MANPREFIX)/man1 && rm -f rs.1
     57 
     58 clean:
     59 	@echo cleaning
     60 	@rm -f $(BIN) $(OBJ) $(LIB) util.a