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