blob: 27056b35568900e6b73db69696082aed2fef5a1f [file] [log] [blame]
Patches by Robin H. Johnson <robbat2@gentoo.org> - 2005/12/27
Previously using GCC you had to do make clean between making each of the
seperate utilities. This was due to the fact that depending on what compiler
defines were passed, the output was different.
The following patch makes the output files reflect which utility they are
compiled for, so they don't conflict, and no make clean is needed.
This patch also adds a top level Makefile to allow quick building of the entire
package.
Also fixes parallel build issues in compiler/ and two compile issues with
acpibin.
diff -Naur acpica-unix-20051216/Makefile acpica-unix-20051216.new/Makefile
--- acpica-unix-20051216/Makefile 1969-12-31 16:00:00.000000000 -0800
+++ acpica-unix-20051216.new/Makefile 2005-12-27 10:15:13.000000000 -0800
@@ -0,0 +1,29 @@
+PROGS= compiler/iasl tools/acpiexec/acpiexec tools/acpibin/acpibin tools/acpisrc/acpisrc
+ifndef CFLAGS
+CFLAGS= -O2
+endif
+
+all: $(PROGS)
+
+iasl: compiler
+acpiexec: tools/acpiexec
+acpibin: tools/acpibin
+acpisrc: tools/acpisrc
+
+SUBDIRS = $(dir $(PROGS))
+.PHONY: $(SUBDIRS) all
+
+compiler: compiler/iasl
+tools/acpiexec: tools/acpiexec/acpiexec
+tools/acpibin: tools/acpibin/acpibin
+tools/acpisrc: tools/acpisrc/acpisrc
+
+
+$(PROGS):
+ CFLAGS="$(CFLAGS)" $(MAKE) -C $(dir $(@))
+
+clean: clean-subdirs
+clean-subdirs:
+ for dir in $(SUBDIRS); do \
+ $(MAKE) -C $$dir clean; \
+ done
diff -Naur acpica-unix-20051216/compiler/Makefile acpica-unix-20051216.new/compiler/Makefile
--- acpica-unix-20051216/compiler/Makefile 2005-12-16 14:11:58.000000000 -0800
+++ acpica-unix-20051216.new/compiler/Makefile 2005-12-27 10:07:34.000000000 -0800
@@ -81,7 +81,7 @@
../osunixxf.c
NOMAN= YES
-CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include
+CFLAGS+= -Wall -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include
#YACC= yacc
YACC= bison
@@ -95,14 +95,22 @@
#CFLAGS+= -D_USE_BERKELEY_YACC
#.endif
-aslmain : $(patsubst %.c,%.o, $(SRCS))
- $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) \
+%.iasl.o: %.c
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
+
+OBJS= $(patsubst %.c,%.iasl.o, $(SRCS))
+
+aslmain : $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) \
$(LOADLIBES) $(LDLIBS) -o iasl
CLEANFILES= y.output y.tab.c y.tab.h aslcompiler.y.h \
aslcompilerparse.c aslcompilerlex.c iasl
-aslcompilerparse.c: aslcompiler.y
+# force the YACC work to be done before any sources
+# as they all depend on it.
+$(SRCS): aslcompiler.y.h
+aslcompiler.y.h: aslcompiler.y
${YACC} ${YFLAGS} aslcompiler.y
cp y.tab.c aslcompilerparse.c
cp y.tab.h aslcompiler.y.h
@@ -111,5 +119,5 @@
${LEX} ${LFLAGS} -PAslCompiler -oaslcompilerlex.c aslcompiler.l
clean :
- rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS))
+ rm -f $(CLEANFILES) $(OBJS)
diff -Naur acpica-unix-20051216/tools/acpibin/Makefile acpica-unix-20051216.new/tools/acpibin/Makefile
--- acpica-unix-20051216/tools/acpibin/Makefile 2005-12-16 14:12:10.000000000 -0800
+++ acpica-unix-20051216.new/tools/acpibin/Makefile 2005-12-27 09:43:28.000000000 -0800
@@ -12,14 +12,18 @@
../../osunixxf.c \
../../common/getopt.c
-CFLAGS+= -Wall -O2 -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include
+CFLAGS+= -Wall -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include
+%.acpibinsrc.o: %.c
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
-acpibin : $(patsubst %.c,%.o, $(SRCS))
- $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG)
+OBJS= $(patsubst %.c,%.acpibinsrc.o, $(SRCS))
+
+acpibin : $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
CLEANFILES= $(PROG)
clean :
- rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS))
+ rm -f $(CLEANFILES) $(OBJS)
diff -Naur acpica-unix-20051216/tools/acpibin/abcompare.c acpica-unix-20051216.new/tools/acpibin/abcompare.c
--- acpica-unix-20051216/tools/acpibin/abcompare.c 2005-12-16 14:12:10.000000000 -0800
+++ acpica-unix-20051216.new/tools/acpibin/abcompare.c 2005-12-26 23:44:16.000000000 -0800
@@ -116,6 +116,7 @@
*****************************************************************************/
#include "acpibin.h"
+#define O_BINARY 0
#include <stdlib.h>
diff -Naur acpica-unix-20051216/tools/acpibin/acpibin.h acpica-unix-20051216.new/tools/acpibin/acpibin.h
--- acpica-unix-20051216/tools/acpibin/acpibin.h 2005-12-16 14:12:10.000000000 -0800
+++ acpica-unix-20051216.new/tools/acpibin/acpibin.h 2005-12-26 23:44:02.000000000 -0800
@@ -120,9 +120,9 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
-#include <io.h>
+#include <sys/io.h>
#include <ctype.h>
-#include <direct.h>
+//#include <direct.h>
#include <errno.h>
#include "acpi.h"
diff -Naur acpica-unix-20051216/tools/acpiexec/Makefile acpica-unix-20051216.new/tools/acpiexec/Makefile
--- acpica-unix-20051216/tools/acpiexec/Makefile 2005-12-16 14:12:10.000000000 -0800
+++ acpica-unix-20051216.new/tools/acpiexec/Makefile 2005-12-27 09:41:46.000000000 -0800
@@ -130,14 +130,18 @@
../../osunixxf.c
-CFLAGS+= -Wall -g -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -D_MULTI_THREADED -Wstrict-prototypes -I../../include
+CFLAGS+= -Wall -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -D_MULTI_THREADED -Wstrict-prototypes -I../../include
+%.acpiexec.o: %.c
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
-acpiexec : $(patsubst %.c,%.o, $(SRCS))
- $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG)
+OBJS = $(patsubst %.c,%.acpiexec.o, $(SRCS))
+
+acpiexec : $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
CLEANFILES= $(PROG)
clean :
- rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS))
+ rm -f $(CLEANFILES) $(OBJS)
diff -Naur acpica-unix-20051216/tools/acpisrc/Makefile acpica-unix-20051216.new/tools/acpisrc/Makefile
--- acpica-unix-20051216/tools/acpisrc/Makefile 2005-12-16 14:12:11.000000000 -0800
+++ acpica-unix-20051216.new/tools/acpisrc/Makefile 2005-12-27 09:43:21.000000000 -0800
@@ -4,14 +4,18 @@
SRCS= ascase.c asconvrt.c asfile.c asmain.c asremove.c asutils.c osunixdir.c \
../../common/getopt.c
-CFLAGS+= -Wall -O2 -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include
+CFLAGS+= -Wall -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include
+%.acpibinsrc.o: %.c
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
-aslmain : $(patsubst %.c,%.o, $(SRCS))
- $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG)
+OBJS= $(patsubst %.c,%.acpibinsrc.o, $(SRCS))
+
+aslmain : $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
CLEANFILES= $(PROG)
clean :
- rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS))
+ rm -f $(CLEANFILES) $(OBJS)