Moved Makefile to top dir

Also added the installation of the man page.
This commit is contained in:
wiire-a 2017-12-24 16:43:30 +01:00 committed by rofl0r
parent 7ae30e8a08
commit fa4b514369
3 changed files with 41 additions and 31 deletions

41
Makefile Normal file
View File

@ -0,0 +1,41 @@
CFLAGS = -std=c99 -O3
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
SRCDIR = src
LIBS = -lpthread
ifeq ($(OPENSSL),1)
LIBS += -lcrypto
CFLAGS += -DUSE_OPENSSL
else
CRYDIR = $(SRCDIR)/mbedtls
CRYPTO = $(CRYDIR)/sha256.c $(CRYDIR)/md.c $(CRYDIR)/md_wrap.c
endif
TARGET = pixiewps
SOURCE = $(SRCDIR)/pixiewps.c $(CRYPTO)
-include config.mak
.PHONY: all install install-bin install-man clean
all: $(TARGET)
$(TARGET):
$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(SOURCE) $(LIBS) $(LDFLAGS)
install: install-bin install-man
install-bin: $(TARGET)
install -d $(DESTDIR)$(BINDIR)
install -m 755 $< $(DESTDIR)$(BINDIR)
install-man: pixiewps.1
install -d $(DESTDIR)$(MANDIR)/man1
install -m 644 $< $(DESTDIR)$(MANDIR)/man1
clean:
rm -f $(TARGET)

View File

@ -42,7 +42,6 @@ or
```bash
cd pixiewps*/
cd src/
make
```
Optionally, you can run `make OPENSSL=1` to use faster OpenSSL SHA-256 functions.

View File

@ -1,30 +0,0 @@
CFLAGS = -std=c99 -O3
LIBS = -lpthread
ifeq ($(OPENSSL),1)
LIBS += -lcrypto
CFLAGS += -DUSE_OPENSSL
else
CRYPTO = mbedtls/sha256.c mbedtls/md.c mbedtls/md_wrap.c
endif
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
TARGET = pixiewps
SOURCE = $(TARGET).c $(CRYPTO)
-include config.mak
all:
$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(SOURCE) $(LIBS) $(LDFLAGS)
debug:
$(CC) $(CFLAGS) $(CPPFLAGS) -DDEBUG -o $(TARGET) $(SOURCE) $(LIBS) $(LDFLAGS)
install:
install -d $(DESTDIR)$(BINDIR)
install -m 755 $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
clean:
rm -f $(TARGET)