Makefile (1186B)
1 TARGET?= 2 3 BIN=supercop 4 5 VERSION?=n/a 6 7 SRC:= 8 SRC+=$(wildcard src/*.c) 9 SRC+=$(wildcard src/*/*.c) 10 SRC+=$(wildcard src/*/*/*.c) 11 SRC+=$(wildcard src/*/*/*/*.c) 12 13 # Ourselves 14 MTUNE?=native 15 MARCH?=native 16 CFLAGS?= 17 CFLAGS+=-D VERSION=\"$(VERSION)\" 18 CFLAGS+=-mtune=$(MTUNE) -march=$(MARCH) 19 CFLAGS+=-O2 -pipe 20 CFLAGS+=-Wall -Wextra 21 22 INCLUDES:= 23 INCLUDES+=-I src 24 25 include lib/.dep/config.mk 26 27 # Target-specific overrides, optional. 28 # Supplied by target/<target>/Makefile.target 29 -include Makefile.target 30 31 CFLAGS+=$(INCLUDES) 32 33 OBJ:=$(SRC:.c=.o) 34 35 .PHONY: default 36 default: $(BIN) 37 38 %.o: %.c $(LIBS) 39 $(CC) $(CFLAGS) $(@:.o=.c) -D__NAME=\"$(BIN)\" -D__TARGET=\"$(TARGET)\" -c -o $@ 40 41 $(BIN): $(OBJ) 42 $(CC) $(CFLAGS) $(OBJ) -o $@ 43 44 .PHONY: static 45 static: 46 CFLAGS="-static -Os -s" $(MAKE) "MTUNE=$(MTUNE)" "MARCH=$(MARCH)" $(BIN) 47 strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag $(BIN) 48 49 .PHONY: clean 50 clean: 51 rm -f $(OBJ) $(BIN) 52 53 .PHONY: install 54 install: $(BIN) 55 install -Dm0755 $(BIN) $(DESTDIR)/bin/$(BIN) 56 install -Dm0644 man/supercop.1 $(DESTDIR)/share/man/man1/supercop.1