summaryrefslogtreecommitdiffstats
path: root/vendor/sysinfo/Makefile
blob: 0dc114ce889987cef7bb90fb6f6c25f8024fecb5 (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
41
42
43
44
45
#
# Sysinfo
#
# Copyright (c) 2017 Guillaume Gomez
#

#
# Please note that this Makefile only generates the c example.
#

IDIR = ./src
CC = gcc
CFLAGS = -I$(IDIR)

ODIR = examples/
LDIR = ./target/debug/
LDIR-RELEASE = ./target/release/

LIBS = -lsysinfo -lpthread

_DEPS = sysinfo.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))

_OBJ = simple.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))


simple: $(OBJ)
	@echo "Compiling in debug mode"
	cargo build --features=c-interface
	gcc -o $@ $^ $(CFLAGS) -L$(LDIR) $(LIBS)

release: $(OBJ)
	@echo "Compiling in release mode"
	cargo build --features=c-interface --release
	gcc -o simple $^ $(CFLAGS) -L$(LDIR-RELEASE) $(LIBS)

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

.PHONY: simple

clean:
	@echo "Cleaning mess"
	rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~