33 lines
704 B
Makefile
33 lines
704 B
Makefile
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
|