Makefile for compiling both C and Java programs at the same time

I have three programs that need to be compiled simultaneously, 2 written in C and 1 in java. I had all three works with the Makefile when they were in C, but then rewrote one of them in java ... is there a way to compile all 3 at the same time with the same make file?

Here is my current Makefile:

CC=gcc 
JC=javac 
JFLAGS= -g
CFLAGS= -Wall -g -std=c99
LDFLAGS= -lm
.SUFFIXES: .java .class
.java.class:
 $(JC) $(JFLAGS) $*.java

CLASSES = kasiski.java kentry.java

ALL= ic ftable kasiski

all: $(ALL)

ic: ic.o

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

ftable: ftable.o

ic.o: ic.c ic.h

ftable.o: ftable.c ftable.h

.PHONY: clean

clean:
 rm -rf core* *.class *.o *.gch $(ALL)
+3
source share
1 answer

, . "" , " " . "-j3" / (, "" ). , :

  •  
  • "CC", "CFLAGS" "LDFLAGS". "CC", C , "CFLAGS" "LDFLAGS" ( + =) , , Makefile ( ). 
  • CLASSES ".java" ... , JAVA_SRCS JAVA_CLASSES = ${JAVA_SRCS:.java =.class}.

. Makefile. , , ​​ Bazel Gradle. , , ( ) .

+3

Source: https://habr.com/ru/post/1745727/


All Articles