Add clang support
[modules.git] / Makefile
index baae7834099e0ca513b835b506088558b8bababf..764d97e4a9542ea415ac7d5ad212a1a771aafdfa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,25 @@
-CXXFLAGS = -fmodules-ts -std=c++20
-CC = g++
+#CXXFLAGS = -fmodules-ts -std=c++20
+#CXX = g++
 
-main: main.o helloworld.o
+CXX = clang++
+CXXFLAGS = -std=c++20 -fimplicit-modules -fprebuilt-module-path=. -fmodules-cache-path=foo
+
+APP = hellomodules
+OBJS = main.o helloworld.o
+MODS = helloworld.pcm
+
+all: $(APP)
 
 clean:
-       rm main *.o
+       rm -f $(APP)
+       rm -f $(OBJS)
+       rm -f $(MODS)
 
-main.o: main.cc
+$(APP): $(OBJS)
+       $(CXX) $(CXXFLAGS) -o $@ $?
+
+main.o: main.cc $(MODS)
 helloworld.o: helloworld.cc
+
+helloworld.pcm: helloworld.cc
+       $(CXX) $(CXXFLAGS) -Xclang -emit-module-interface -c helloworld.cc -o helloworld.pcm