-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (49 loc) · 1.24 KB
/
Makefile
File metadata and controls
66 lines (49 loc) · 1.24 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# For windows and linux
ifeq ($(OS), Windows_NT)
EXECLEAN = execlean-windows
CLEANER = clean-windows
DLL = .dll
LDL =
else
EXECLEAN = execlean-linux
CLEANER = clean-linux
DLL = .so
LDL = -ldl
endif
CC = gcc
CPP = g++
CPPFLAGS = -g -Wall
CFLAGS = -g -Wall -std=c11
DLLFLAGS = -shared -fPIC
SRC = leapfrog use_lib
OUT = out.exe
EXTRA = -I./include
EXE = -D OUT_EXE
.PHONY: ctest cpptest clean-linux clean-windows clean cleanall execlean-linux execlean-windows
.PHONY: pypi_upload pybuild
all:
$(CC) $(CFLAGS) $(DLLFLAGS) ./csrc/leapfrog.c -o ./lpfgopt/leapfrog_c$(DLL) $(EXTRA)
ctest:
$(CC) $(CFLAGS) $(foreach var,$(SRC), ./csrc/$(var).c)\
-o $(OUT) $(EXTRA) $(EXE)
cpptest: all
$(CPP) $(CPPFLAGS) ./csrc/use_dll.cpp -o $(OUT) $(LDL)
execlean-linux:
rm -f *.exe
clean-linux: execlean-linux
rm -f ./lpfgopt/*.so ./lpfgopt/*.dll
rm -rf ./build ./dist ./*.egg-info
execlean-windows:
del *.exe
clean-windows: execlean-windows
del .\lpfgopt\*.dll
del .\lpfgopt\*.so
if exist .\build rmdir /S/Q .\build
if exist .\dist rmdir /S/Q .\dist
if exist .\lpfgopt.egg-info rmdir /S/Q .\lpfgopt.egg-info
cleanall: $(CLEANER)
clean: $(EXECLEAN)
pybuild:
python setup.py sdist bdist_wheel
pypi_upload: pybuild
python -m twine upload dist/*