-
-
Notifications
You must be signed in to change notification settings - Fork 312
/
Makefile
45 lines (33 loc) · 841 Bytes
/
Makefile
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 rustc --features=c-interface --crate-type cdylib
gcc -o $@ $^ $(CFLAGS) -L$(LDIR) $(LIBS)
release: $(OBJ)
@echo "Compiling in release mode"
cargo rustc --features=c-interface --release --crate-type cdylib
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)/*~