I've written this makefile:
And I want %/ to be always ran. .PHONY doesn't seem to work, what else could I try?
Code:
PATHS := ${shell echo */ | grep -v "*/"}
OBJ := ${subst cpp,o,${shell echo *.cpp | grep -v "*.cpp"}}
.PHONY: build
build : $(PATHS)
@echo ═════════════════════════════════════════
@echo [*] Linking
@echo ═════════════════════════════════════════
mkdir -p build
-mv ${shell find src -type f -name "*.o"} build
$(CXX) $(CXXFLAGS) ${shell echo build/*.o} -lSDL2 -lSDL2_image -o NewSuperTux
.PHONY: subdirectory
subdirectory : $(PATHS) $(OBJ)
rm makefile
@echo ------- Finished $*/ -------
.PHONY: clean
clean :
@echo ═════════════════════════════════════════
@echo [*] Cleaning up
@echo ═════════════════════════════════════════
rm -rf build
%/ :
@echo ═════════════════════════════════════════
@echo [!] Entering subdirectory $*/
@echo ═════════════════════════════════════════
cp makefile $*/
cd $* && make subdirectory
%.o : %.cpp
@echo ═════════════════════════════════════════
@echo [*] Compiling $^
@echo ═════════════════════════════════════════
$(CXX) $(CXXFLAGS) -c $^
Last edited by StackMasher,






