John Stultz | 5c69c8c | 2015-11-23 17:13:51 -0800 | [diff] [blame] | 1 | MAKEFLAGS += --no-print-directory |
| 2 | |
| 3 | PREFIX ?= /usr |
| 4 | SBINDIR ?= $(PREFIX)/sbin |
| 5 | MANDIR ?= $(PREFIX)/share/man |
| 6 | |
| 7 | MKDIR ?= mkdir -p |
| 8 | INSTALL ?= install |
| 9 | CC ?= "gcc" |
| 10 | |
| 11 | CFLAGS ?= -O2 -g |
| 12 | CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration |
| 13 | |
| 14 | OBJS = uim.o |
| 15 | ALL = uim |
| 16 | |
| 17 | ifeq ($(V),1) |
| 18 | Q= |
| 19 | NQ=true |
| 20 | else |
| 21 | Q=@ |
| 22 | NQ=echo |
| 23 | endif |
| 24 | |
| 25 | all: $(ALL) |
| 26 | |
| 27 | VERSION_OBJS := $(filter-out version.o, $(OBJS)) |
| 28 | |
| 29 | %.o: %.c uim.h |
| 30 | @$(NQ) ' CC ' $@ |
| 31 | $(Q)$(CC) $(CFLAGS) -c -o $@ $< |
| 32 | |
| 33 | uim: $(OBJS) |
| 34 | @$(NQ) ' CC ' uim |
| 35 | $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o uim |
| 36 | |
| 37 | check: |
| 38 | $(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc" |
| 39 | |
| 40 | install: uim |
| 41 | @$(NQ) ' INST uim' |
| 42 | $(Q)$(MKDIR) $(DESTDIR)$(SBINDIR) |
| 43 | $(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(SBINDIR) uim |
| 44 | |
| 45 | clean: |
| 46 | $(Q)rm -f uim *.o *~ |