Skip to content

Commit 421f818

Browse files
committed
Improve makefile.
1 parent 3ea1f10 commit 421f818

1 file changed

Lines changed: 30 additions & 9 deletions

File tree

demos/video/chapel-webcam/Makefile

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11

2-
include lib/Makefile.smol
2+
-include lib/Makefile.smol
33

4-
all: libsmol cppmain
4+
5+
all: main
56

67
# chpl --library --library-makefile --library-cmakelists smol.chpl
78

8-
libsmol: smol.chpl
9+
10+
LIB_GEN_CMD = \
911
chpl \
1012
--library \
1113
--dynamic \
@@ -16,6 +18,31 @@ libsmol: smol.chpl
1618
--no-munge-with-ids \
1719
smol.chpl
1820

21+
22+
pre-build:
23+
if [ -d lib ]; then \
24+
echo "lib directory already exists" \
25+
else \
26+
$(LIB_GEN_CMD) \
27+
fi
28+
29+
30+
31+
libsmol: smol.chpl
32+
$(LIB_GEN_CMD)
33+
34+
35+
main: main.cpp smol_wrapper.h lib/libsmol.so
36+
$(CHPL_COMPILER) $(CHPL_CFLAGS) -fPIC main.cpp -o main $(CHPL_LDFLAGS)
37+
38+
clean:
39+
rm -f maincpp maincpp.o main.o main
40+
41+
cleanall: clean
42+
rm -rf lib
43+
44+
45+
1946
cmain: main.c
2047
$(CHPL_COMPILER) $(CHPL_CFLAGS) -o main main.c $(CHPL_LDFLAGS)
2148

@@ -59,9 +86,3 @@ maincpp.o: main.cpp smol_wrapper.h
5986
# $(CHPL_LINKER) -o maincpp maincpp.o
6087
# #$(CHPL_LINKER) $(CHPL_CFLAGS) -o main main.o $(CHPL_LDFLAGS)
6188

62-
maincpp: main.cpp smol_wrapper.h
63-
$(CHPL_COMPILER) $(CHPL_CFLAGS) -fPIC main.cpp -o main $(CHPL_LDFLAGS)
64-
65-
clean:
66-
rm -f maincpp maincpp.o main.o main
67-
# rm -f main lib/libsmol.a

0 commit comments

Comments
 (0)