linkd

Control plane daemon for unos
git clone git://git.finwo.net/app/linkd
Log | Files | Refs | README

Makefile (802B)


      1 BIN=bcm
      2 
      3 # Path to a built OpenBCM SDK tree. Supplied by the openbcm package build;
      4 # there is no sensible default, so the build fails loudly without it.
      5 SDK?=
      6 
      7 CFLAGS?=-Wall -Wextra -O2
      8 
      9 INCLUDES:=
     10 INCLUDES+=-I src
     11 
     12 LDFLAGS?=
     13 
     14 ifneq ($(SDK),)
     15 INCLUDES+=-I $(SDK)/include
     16 LDFLAGS +=-L $(SDK)/build -lbcm
     17 endif
     18 
     19 include lib/.dep/config.mk
     20 
     21 CFLAGS+=$(INCLUDES)
     22 
     23 SRC+=$(wildcard src/*.c)
     24 OBJ:=$(SRC:.c=.o)
     25 
     26 .PHONY: default
     27 default: check $(BIN)
     28 
     29 .PHONY: check
     30 check:
     31 	@test -n "$(SDK)" || { \
     32 	  echo "SDK= is required: point it at a built OpenBCM SDK tree"; \
     33 	  exit 1; \
     34 	}
     35 
     36 %.o: %.c
     37 	$(CC) $(CFLAGS) $< -c -o $@
     38 
     39 $(BIN): $(OBJ)
     40 	$(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) -o $@
     41 
     42 .PHONY: clean
     43 clean:
     44 	rm -f $(OBJ) $(BIN)
     45 
     46 .PHONY: install
     47 install: $(BIN)
     48 	install -Dm0755 $(BIN) $(DESTDIR)/usr/lib/linkd/$(BIN)