-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