48 lines
696 B
Makefile
48 lines
696 B
Makefile
|
.POSIX: # Just kidding, use GNU Make
|
||
|
|
||
|
CP := cp -f
|
||
|
|
||
|
CC := cc
|
||
|
CFLAGS := -std=c99 -Wall -Wextra -Wpedantic
|
||
|
LDFLAGS := -lgmp -lreadline
|
||
|
|
||
|
OBJ := dc.o
|
||
|
|
||
|
ifeq ($(DEBUG),1)
|
||
|
CFLAGS += -Og -g
|
||
|
else
|
||
|
CFLAGS += -O3 -funroll-loops -fomit-frame-pointer
|
||
|
endif
|
||
|
|
||
|
ifdef SAN
|
||
|
CFLAGS += -fsanitize=$(SAN)
|
||
|
endif
|
||
|
|
||
|
ifeq ($(FOR_HUMANS),1)
|
||
|
CPPFLAGS += -DFOR_HUMANS
|
||
|
endif
|
||
|
|
||
|
ifeq ($(DC_COMPLY),1)
|
||
|
CPPFLAGS += -DDC_COMPLY
|
||
|
endif
|
||
|
|
||
|
ifdef PROGN
|
||
|
CPPFLAGS += -DPROGN=\"$(PROGN)\"
|
||
|
else
|
||
|
PROGN := dc
|
||
|
endif
|
||
|
|
||
|
%.o: %.c
|
||
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||
|
|
||
|
$(PROGN): $(OBJ)
|
||
|
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $< $(LDFLAGS)
|
||
|
|
||
|
config.h: config.mk.h
|
||
|
$(CP) $< $@
|
||
|
|
||
|
dc.o: config.h ns.c
|
||
|
|
||
|
clean:
|
||
|
$(RM) $(OBJ) $(PROGN)
|