Calculator/Makefile

34 lines
704 B
Makefile
Raw Normal View History

2023-11-26 15:56:00 +01:00
CC = clang
CX = clang++
CODE ?= wasm
MOBJS = calc.yy.o calc.tab.o calculator.o
ifeq ($(CODE),wasm)
include wasm.mk
else
include unix.mk
endif
OBJS = $(MOBJS) $(MAIN)
CFLAGS += -Wno-unused-function
all: $(PR)
%.o: %.cpp
$(CX) -std=c++14 -c $(CFLAGS) -fno-exceptions -fno-rtti $< -o $@
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
calc.tab.o: calc.tab.c
$(CX) -std=c++14 -c $(CFLAGS) -Wno-deprecated -Wno-writable-strings -fno-exceptions -fno-rtti $< -o $@
$(PR): $(OBJS) $(WALIB)
$(LD) $(LFLAGS) $(OBJS) -o $(PR) $(LDLIBS)
calc.yy.cpp: calc.l calc.tab.h
flex calc.l
calc.tab.c calc.tab.h: calc.y
bison -d calc.y
clean:
rm -f *.o *.yy.* *.tab.*
distclean: clean
rm -f $(PR)
.PHONY: all clean distclean