Skip to content
Snippets Groups Projects
Makefile 648 B
Newer Older
  • Learn to ignore specific revisions
  • CFLAGS=-Wall -pedantic -Wextra -g #-fsanitize=address,undefined
    
    LFLAGS=
    
    OUTPUT=fml
    
    SRC_DIR=./src
    BUILD_DIR=./build
    
    .PHONY: init fml
    
    all: init fml
    
    
    fml: $(BUILD_DIR)/arena.o $(BUILD_DIR)/parser.o $(BUILD_DIR)/ast_interpreter.o $(SRC_DIR)/fml.c #$(BUILD_DIR)/%.o
    
    	$(CC) $(CFLAGS) $(LFLAGS) $? -o $(OUTPUT)
    
    
    %.o: $(SRC_DIR)/%.c
    	$(CC) $(CFLAGS) -c $< -o $@
    	
    
    $(BUILD_DIR)/ast_interpreter.o: $(SRC_DIR)/parser.o $(SRC_DIR)/ast_interpreter.c
    	$(CC) $(CFLAGS) -c $? -o $@
    	
    
    $(BUILD_DIR)/parser.o: $(SRC_DIR)/parser.c
    	$(CC) $(CFLAGS) -c $< -o $@
    	
    $(BUILD_DIR)/arena.o: $(SRC_DIR)/arena.c
    	$(CC) $(CFLAGS) -c $< -o $@