summaryrefslogtreecommitdiffstats
path: root/development/acpica/acpica-unix-20060512-buildfixup.patch
blob: 5a08da4f5aa6da474bdd6a71ac47b6f27c18fba2 (plain)
Patches by Robin H. Johnson <robbat2@gentoo.org> - 2006/05/29

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/, where the yacc generated data
might used before it was ready.

diff -Nuar --exclude '*~' acpica-unix-20060512.orig/Makefile acpica-unix-20060512/Makefile
--- acpica-unix-20060512.orig/Makefile	1969-12-31 16:00:00.000000000 -0800
+++ acpica-unix-20060512/Makefile	2006-05-29 16:28:55.560238471 -0700
@@ -0,0 +1,31 @@
+PROGS= compiler/iasl  tools/acpiexec/acpiexec tools/acpixtract/acpixtract tools/acpisrc/acpisrc
+ifndef CFLAGS
+CFLAGS= -O2 -g
+endif
+# warnings always important
+CFLAGS += -Wall -Wstrict-prototypes
+
+all: $(PROGS)
+
+iasl: compiler
+acpiexec: tools/acpiexec
+acpixtract: tools/acpixtract
+acpisrc: tools/acpisrc
+
+SUBDIRS = $(dir $(PROGS))
+.PHONY: $(SUBDIRS) all
+
+compiler: compiler/iasl
+tools/acpiexec: tools/acpiexec/acpiexec
+tools/acpixtract: tools/acpixtract/acpixtract
+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 -Nuar --exclude '*~' acpica-unix-20060512.orig/compiler/Makefile acpica-unix-20060512/compiler/Makefile
--- acpica-unix-20060512.orig/compiler/Makefile	2006-05-12 14:13:31.000000000 -0700
+++ acpica-unix-20060512/compiler/Makefile	2006-05-29 16:34:25.050744637 -0700
@@ -87,7 +87,7 @@
 	../osunixxf.c
 
 NOMAN=	YES
-CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include 
+CFLAGS+= -D_LINUX -DACPI_ASL_COMPILER -I../include 
 
 #YACC=	yacc
 YACC=	bison
@@ -101,14 +101,22 @@
 #CFLAGS+= -D_USE_BERKELEY_YACC
 #.endif
 
-aslmain : $(patsubst %.c,%.o, $(SRCS))
-	$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) \
-		$(LOADLIBES) $(LDLIBS) -o iasl
+OBJNAME = iasl
+OBJS= $(patsubst %.c,%.$(OBJNAME).o, $(SRCS))
+%.$(OBJNAME).o: %.c
+	$(COMPILE.c) $(OUTPUT_OPTION) $<
+
+$(PROG) : $(OBJS)
+	$(CC) $(LDFLAGS) $(OBJS) \
+		$(LOADLIBES) $(LDLIBS) -o $(PROG)
 
 CLEANFILES= y.output y.tab.c y.tab.h aslcompiler.y.h \
-	aslcompilerparse.c aslcompilerlex.c iasl
+	aslcompilerparse.c aslcompilerlex.c $(PROG)
 
-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
@@ -117,5 +125,5 @@
 	${LEX} ${LFLAGS} -PAslCompiler -oaslcompilerlex.c aslcompiler.l
 
 clean : 
-	rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS))
+	rm -f $(CLEANFILES) $(OBJS)
 
diff -Nuar --exclude '*~' acpica-unix-20060512.orig/tools/acpiexec/Makefile acpica-unix-20060512/tools/acpiexec/Makefile
--- acpica-unix-20060512.orig/tools/acpiexec/Makefile	2006-05-12 14:13:43.000000000 -0700
+++ acpica-unix-20060512/tools/acpiexec/Makefile	2006-05-29 16:33:43.551484557 -0700
@@ -131,14 +131,19 @@
 	../../osunixxf.c
 
 
-CFLAGS+= -Wall -g -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -D_MULTI_THREADED -Wstrict-prototypes -I../../include 
+CFLAGS+= -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -D_MULTI_THREADED -I../../include 
 
+OBJNAME = acpiexec
+OBJS= $(patsubst %.c,%.$(OBJNAME).o, $(SRCS))
 
-acpiexec : $(patsubst %.c,%.o, $(SRCS))
-	$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG)
+%.$(OBJNAME).o: %.c
+	$(COMPILE.c) $(OUTPUT_OPTION) $<
+
+$(PROG): $(OBJS)
+	$(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
 
 CLEANFILES= $(PROG)
 
 clean : 
-	rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS))
+	rm -f $(CLEANFILES) $(OBJS)
 
diff -Nuar --exclude '*~' acpica-unix-20060512.orig/tools/acpisrc/Makefile acpica-unix-20060512/tools/acpisrc/Makefile
--- acpica-unix-20060512.orig/tools/acpisrc/Makefile	2006-05-12 14:13:44.000000000 -0700
+++ acpica-unix-20060512/tools/acpisrc/Makefile	2006-05-29 16:33:03.300322581 -0700
@@ -4,14 +4,19 @@
 SRCS=	ascase.c asconvrt.c asfile.c asmain.c asremove.c astable.c \
         asutils.c osunixdir.c ../../common/getopt.c
 
-CFLAGS+= -Wall -O2 -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include 
+CFLAGS+= -D_LINUX -DACPI_APPLICATION -I../../include 
 
+OBJNAME = acpi_application
+OBJS= $(patsubst %.c,%.$(OBJNAME).o, $(SRCS))
 
-aslmain : $(patsubst %.c,%.o, $(SRCS))
-	$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG)
+%.$(OBJNAME).o: %.c
+	$(COMPILE.c) $(OUTPUT_OPTION) $<
+
+$(PROG) : $(OBJS)
+	$(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
 
 CLEANFILES= $(PROG)
 
 clean : 
-	rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS))
+	rm -f $(CLEANFILES) $(OBJS)
 
diff -Nuar --exclude '*~' acpica-unix-20060512.orig/tools/acpixtract/Makefile acpica-unix-20060512/tools/acpixtract/Makefile
--- acpica-unix-20060512.orig/tools/acpixtract/Makefile	2006-05-12 14:13:44.000000000 -0700
+++ acpica-unix-20060512/tools/acpixtract/Makefile	2006-05-29 16:32:50.047281484 -0700
@@ -3,14 +3,19 @@
 PROG=	acpixtract
 SRCS=	acpixtract.c
 
-CFLAGS+= -Wall -O2 -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include 
+CFLAGS+= -D_LINUX -DACPI_APPLICATION -I../../include 
 
+OBJNAME = acpi_application
+OBJS= $(patsubst %.c,%.$(OBJNAME).o, $(SRCS))
 
-acpixtract : $(patsubst %.c,%.o, $(SRCS))
-	$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG)
+%.$(OBJNAME).o: %.c
+	$(COMPILE.c) $(OUTPUT_OPTION) $<
+ 
+$(PROG) : $(OBJS)
+	$(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
 
 CLEANFILES= $(PROG)
 
 clean : 
-	rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS))
+	rm -f $(CLEANFILES) $(OBJS)