im writing a makefile for a java aplication using javaFX, so when the app is compiled or run the command needs to specify the path to the javaFX library, with an option that looks like this:

--module-path C:\Users\Natt\Desktop\javafx-sdk-16\lib --add-modules javafx.controls,javafx.fxml

in my makefile i have this set up as a macro called LIB, and if i have to change the path in a different computer i have to manually edit the makefile, is there a way of defining a rule "setLib" such that it acquires the path from the command line and edits the value of LIB such that i can type:


here is the full makefile for reference:

JFLAGS = -g -Xlint
JC = javac
JVM = java
FILE = input.txt
LIB = --module-path /home/seba2021/2021/usm/POO/Tool/FX/lib --add-modules javafx.controls

.SUFFIXES: .java .class

        $(JC) $(JFLAGS) $(LIB) $*.java

      Comuna.java \
      ComunaView.java \
      Simulator.java \
      SimulatorConfig.java \
      SimulatorMenuBar.java \
      Vacunatorio.java \
      VacunatorioView.java \
      Pedestrian.java \
      PedestrianView.java \

MAIN = Stage4

default: classes

classes: $(CLASSES:.java=.class)

run: $(MAIN).class
        $(JVM) $(LIB) $(MAIN) $(FILE)

        $(RM) *class

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.