summaryrefslogtreecommitdiff
path: root/utils/nwztools/upgtools/Makefile
blob: 5dede1447c6b5ad51fd0b8a30c9312bc756573ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
DEFINES=
CC=gcc
CXX=g++
LD=g++
PROFILE=
PKGCONFIG := $(CROSS)pkg-config

# Distros could use different names for the crypto library. We try a list
# of candidate names, only one of them should be the valid one.
LIBCRYPTO_NAMES = libcryptopp libcrypto++ cryptopp crypto++

$(foreach l,$(LIBCRYPTO_NAMES),\
	$(eval LDOPTS += $(shell $(PKGCONFIG) --silence-errors --libs $(l))))
$(foreach l,$(LIBCRYPTO_NAMES),\
	$(eval CFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))
$(foreach l,$(LIBCRYPTO_NAMES),\
	$(eval CXXFLAGS += $(shell $(PKGCONFIG) --silence-errors --cflags $(l))))

CXXFLAGS=-g $(PROFILE) -Wall $(DEFINES)
CFLAGS=-g $(PROFILE) -Wall -std=c99 $(DEFINES)
LDFLAGS=$(PROFILE) $(LDOPTS) -lpthread

BINS=upgtool

all: $(BINS)

%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

%.o: %.cpp
	$(CXX) $(CXXFLAGS) -c -o $@ $<

upgtool: upgtool.o upg.o misc.o mg.o keysig_search.o md5.o
	$(LD) -o $@ $^ $(LDFLAGS)

clean:
	rm -fr *.o

veryclean:
	rm -rf $(BINS)