Import gPXE contrib directory to create separate directory
[contrib.git] / ppmtoansi / Makefile
1 CPPFLAGS    =
2 LDLIBS      = 
3 CFLAGS      = -pipe -g -O2 -Wall
4 LDFLAGS     = -pipe
5 CC          = gcc
6 LD          = gcc
7 # Some "black" magic to determine optimal compiler flags for target
8 # architecture
9 TARGET_ARCH:= $(shell if [ \! -r .compile-options ] ; then ( \
10                 cpu=`grep cpu /proc/cpuinfo 2>&1 |head -1| \
11                      cut -d : -f 2-| sed -e 's/ //g'`; \
12                 if [ x"$$cpu" = x"" ] ; then \
13                   echo -fno-strength-reduce; \
14                 else if [ "$$cpu" = "386" ] ; then \
15                   echo -m386 -fno-strength-reduce; \
16                 else if [ "$$cpu" = "486" ] ; then \
17                   echo -m486 -fno-strength-reduce; \
18                 else if [ "$$cpu" = "Alpha" ] ; then \
19                   echo -fno-strength-reduce; \
20                 else echo main\(\)\{\} >.compile-options.c; \
21                   if gcc -mpentium -o .compile-options.o -c \
22                          .compile-options.c &>/dev/null; then \
23                      echo -mpentium -fstrength-reduce; \
24                  else if gcc -m486 -malign-functions=2 -malign-jumps=2 \
25                              -malign-loops=2 -o .compile-options.o -c \
26                              .compile-options.c &>/dev/null; then \
27                   echo -n -m486 -malign-functions=2 -malign-jumps=2; \
28                   echo ' '-malign-loops=2 -fno-strength-reduce; \
29                 else echo -m486; \
30               fi;fi;fi;fi;fi;fi) > .compile-options; \
31               rm -f .compile-options.c .compile-options.o; \
32               fi; cat .compile-options)
33 ASFLAGS     = $(TARGET_ARCH)
34
35 OBJS        = ppmtoansi.o
36
37 ##############################################################################
38
39 ifeq (.depend,$(wildcard .depend))
40 all: ppmtoansi
41 include .depend
42 else
43 all: depend
44         @$(MAKE) all
45 endif
46
47 ##############################################################################
48
49 ppmtoansi: $(OBJS)
50
51 ##############################################################################
52
53 clean:
54         $(RM) *~ *.o *.dvi *.log *.aux *yacc.tab.[ch] *yacc.output *lex.[co] \
55               *.dat .depend .tmp_depend .compile-options*
56         strip ppmtoansi >&/dev/null || true
57
58 distclean: clean
59         $(RM) -rf ppmtoansi
60
61 ##############################################################################
62
63 depend:
64         for i in *.c;do $(CPP) $(CPPFLAGS) -MM $$i;done >.tmp_depend
65         mv .tmp_depend .depend
66
67 ##############################################################################