common.mk
1 CFLAGS?= -O2 -pipe 2 OBJS= ${SRCS:.c=.o} 3 SHOBJS?= ${SRCS:.c=.pico} 4 DEPFILES= ${OBJS:.o=.Po} ${SHOBJS:.pico=.Ppico} 5 CFLAGS+= $(CPPFLAGS) 6 CFLAGS+= -Werror=implicit-function-declaration 7 CFLAGS+= -Werror=return-type 8 9 # bmake's traditional include support treats empty strings in the expanded 10 # result (whether because the variable is empty or there are consecutive 11 # whitespace characters) as file names, and thus tries to read the containing 12 # directory as a Makefile, which fails, and isn't ignored since it exists. 13 # Work around this quirky behaviour by adding an extra entry that should never 14 # exist and then normalize its whitespace during substitution with :=. 15 DEPFILES_NONEMPTY= $(DEPFILES) /nonexistent 16 -include $(DEPFILES_NONEMPTY:=) 17 18 .SUFFIXES: .pico .in .bin .binin .so.1 .so.1in .suppress.in .suppress 19 20 .c.o: 21 $(CC) -Wall -Wextra -std=gnu17 -D_GNU_SOURCE=1 -MT $@ -MD -MP -MF $*.Tpo -o $@ -c $(CFLAGS) $(LOCAL_CFLAGS) $< 22 mv $*.Tpo $*.Po 23 24 .c.pico: 25 $(CC) -Wall -Wextra -std=gnu17 -D_GNU_SOURCE=1 -MT $@ -MD -MP -MF $*.Tpico -o $@ -c $(CFLAGS) $(LOCAL_CFLAGS) $(SHOBJ_CFLAGS) $< 26 mv $*.Tpico $*.Ppico 27 28 .in: 29 sed -e 's|@prefix@|$(PREFIX)|g; s|@abs_top_srcdir@|$(top_srcdir)|g' \ 30 -e 's|@VERSION@|$(version)|g' $< > $@ 31 32 .binin.bin: 33 cp $< $@ 34 35 .so.1in.so.1: 36 cp $< $@ 37 38 .suppress.in.suppress: 39 cp $< $@