Makefile (857B)
1 TARGET?= 2 3 BIN=linkd 4 5 SRC:= 6 SRC+=$(wildcard src/*.c) 7 SRC+=$(wildcard src/*/*.c) 8 SRC+=$(wildcard src/*/*/*.c) 9 10 CFLAGS?=-Wall -Wextra -O2 11 LDFLAGS?= 12 13 # Drop unreferenced code: dependencies export whole libraries, of which we use 14 # a part (pbkdf2 also ships SHA-1). 15 CFLAGS +=-ffunction-sections -fdata-sections 16 LDFLAGS+=-Wl,--gc-sections 17 18 INCLUDES:= 19 INCLUDES+=-I src 20 21 include lib/.dep/config.mk 22 23 # Target-specific overrides, optional. 24 # Supplied by target/<target>/Makefile.target 25 -include Makefile.target 26 27 CFLAGS+=$(INCLUDES) 28 29 OBJ:=$(SRC:.c=.o) 30 31 .PHONY: default 32 default: $(BIN) 33 34 %.o: %.c $(LIBS) 35 $(CC) $(CFLAGS) $(@:.o=.c) -D__NAME=\"$(BIN)\" -D__TARGET=\"$(TARGET)\" -c -o $@ 36 37 $(BIN): $(OBJ) 38 $(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) -o $@ 39 40 .PHONY: clean 41 clean: 42 rm -f $(OBJ) $(BIN) 43 44 .PHONY: install 45 install: $(BIN) 46 install -Dm0755 $(BIN) $(DESTDIR)/usr/bin/$(BIN)