Skip to content

Commit

Permalink
Merge pull request #20 from scemama/master
Browse files Browse the repository at this point in the history
Cleaned Makefile
  • Loading branch information
scemama authored Feb 20, 2020
2 parents 3d1e55d + f5b01e8 commit 2c1da97
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ install: libf77zmq.so libf77zmq.a f77_zmq.h
install -m 644 f77_zmq.h $(PREFIX)/include/
install -m 644 f77_zmq_free.h $(PREFIX)/include/

$(ZMQ_H):
$(error $(ZMQ_H) : file not found)

zmq.h: $(ZMQ_H)
cp $(ZMQ_H) zmq.h

libf77zmq.so: f77_zmq.o
$(CC) -shared $^ -o $@

Expand All @@ -29,7 +23,7 @@ libf77zmq.a: f77_zmq.o
f77_zmq.o: f77_zmq.c f77_zmq.h
$(CC) $(CFLAGS) -c f77_zmq.c -o $@

f77_zmq.h: create_f77_zmq_h.py zmq.h f77_zmq.c
f77_zmq.h: create_f77_zmq_h.py f77_zmq.c
python3 create_f77_zmq_h.py

clean:
Expand Down
21 changes: 12 additions & 9 deletions create_f77_zmq_h.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,18 @@ def create_prototypes(lines,file_out):


def find_ZMQ_H():
if "ZMQ_H" is os.environ.keys():
return os.environ["ZMQ_H"]
ZMQ_H = os.environ.get("ZMQ_H")
if ZMQ_H is not None:
print("ZMQ_H defined as {0}".format(ZMQ_H))
return ZMQ_H
else:
if "CPATH" in os.environ.keys():
dirs = os.environ["CPATH"].split(':')
elif "C_INCLUDE_PATH" in os.environ:
dirs = os.environ["C_INCLUDE_PATH"].split(':')
else:
dirs = ["/usr/include", "/usr/local/include"]
for d in dirs:
v = os.environ.get("CPATH")
if v is None:
v = os.environ.get("C_INCLUDE_PATH")
if v is None:
v = "/usr/include:/usr/local/include"

for d in v.split(':'):
if d and "zmq.h" in os.listdir(d):
return ("{0}/zmq.h".format(d))
return None
Expand All @@ -133,6 +135,7 @@ def main():
sys.exit(1)
else:
print("Using {0}".format(ZMQ_H))
os.system("cp {0} .".format(ZMQ_H))

file_out = open('f77_zmq.h','w')

Expand Down

0 comments on commit 2c1da97

Please sign in to comment.