Create Bootable UEFI ISO - hyper-v

I am trying to create a bootable UEFI ISO, but Hyper-V does not see it as a valid UEFI filesystem. What am I doing wrong?
ISO creation:
xorriso -as mkisofs -o uefi.iso -iso-level 3 -V UEFI isoFiles
isoFiles has a single file, boot/hello.efi. When mounted or opened in an archive manager the file exists.
Hyper-V output:
Edit:
Let's have a lot more context for this shall we?
This is the EFI code, it uses gnu-efi v3.0.8:
#include <efi.h>
#include <efilib.h>
EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable){
EFI_STATUS Status;
EFI_INPUT_KEY Key;
ST = SystemTable;
Status = ST->ConOut->OutputString(ST->ConOut, L"Hello world!\n\r");
if(EFI_ERROR(Status)){
return Status;
}
Status = ST->ConIn->Reset(ST->ConIn, FALSE);
if(EFI_ERROR(Status)){
return Status;
}
while((Status = ST->ConIn->ReadKeyStroke(ST->ConIn, &Key)) == EFI_NOT_READY){}
return Status;
}
This is the Makefile for it:
DIR_OUT := ..
TARGET := uefi
OUT := $(DIR_OUT)/out/boot
DIR_SRC := src
DIR_BLD := build
EFI_DIR := gnu-efi-3.0.8
EFI_LIB := $(EFI_DIR)/x86_64/gnuefi/ $(EFI_DIR)/x86_64/lib
EFI_INC := $(EFI_DIR)/inc $(EFI_DIR)/inc/x86_64 $(EFI_DIR)/inc/protocol
EFI_CRT := $(EFI_DIR)/x86_64/gnuefi/crt0-efi-x86_64.o
EFI_LDS := $(EFI_DIR)/gnuefi/elf_x86_64_efi.lds
CFILES := $(wildcard $(DIR_SRC)/*.c)
OFILES := $(patsubst $(DIR_SRC)/%.c,$(DIR_BLD)/%.o,$(CFILES))
PREFIX :=
CC := $(PREFIX)gcc
LD := $(PREFIX)ld
OBJCPY := $(PREFIX)objcopy
INCLUDES := $(addprefix -I,$(EFI_INC))
CFLAGS := -fno-stack-protector -fpic -fshort-wchar -mno-red-zone -Wall -ffreestanding -DEFI_FUNCTION_WRAPPER -c $(INCLUDES)
LDFLAGS := -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic $(addprefix -L,$(EFI_LIB)) $(EFI_CRT)
all: builddir bootdir $(OUT)/$(TARGET).efi
.PRECIOUS: $(OFILES)
clean:
rm -vrf $(OFILES) $(OUT)/$(TARGET).efi
$(OUT)/$(TARGET).efi: $(DIR_BLD)/$(TARGET).efi
cp $< $#
%.efi: %.so
$(OBJCPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc --target=efi-app-x86_64 $^ $#
$(DIR_BLD)/$(TARGET).so: $(OFILES)
$(LD) $(LDFLAGS) $< -o $# -lefi -lgnuefi
$(DIR_BLD)/%.o: $(DIR_SRC)/%.c
$(CC) $(CFLAGS) $< -o $#
bootdir:
mkdir -p $(OUT)
builddir:
mkdir -p $(DIR_BLD)
This is the Makefile that creates the ISO:
ISO_DIR := ..
ISO_FILE := uefi.iso
ISO_LABEL := UEFI
DIR_BLD := build
MKFSISO := xorriso -as mkisofs
FATSIZE := 8M
MKFSVFAT := /sbin/mkfs.vfat
MOUNT := sudo mount
UMOUNT := sudo umount
UID := $(shell id -u gudenau)
GID := $(shell id -g gudenau)
all: buildDir $(ISO_DIR)/$(ISO_FILE)
.PRECIOUS: $(ISO_DIR)/$(ISO_FILE) $(DIR_BLD)/efi.img
$(ISO_DIR)/%.iso: $(DIR_BLD)/efi.img
$(MKFSISO) -o $# -iso-level 3 -V "$(ISO_LABEL)" $(DIR_BLD)/efi.img -e /efi.img -no-emul-boot
%.img:
dd if=/dev/zero of=$# bs=1024 count=1024
$(MKFSVFAT) $#
mkdir -p $(DIR_BLD)/image
$(MOUNT) -o gid=$(GID),uid=$(UID) $# $(DIR_BLD)/image
mkdir -p $(DIR_BLD)/image/EFI/BOOT/
cp ../bootloader/build/uefi.efi $(DIR_BLD)/image/EFI/BOOT/BOOTX64.EFI
$(UMOUNT) $(DIR_BLD)/image
rm -vfr $(DIR_BLD)/image
clean:
rm -vf $(DIR_BLD)/efi.img $(ISO_DIR)/$(ISO_FILE)
buildDir:
mkdir -p $(DIR_BLD)
I know the Makefiles are really bad at the moment, but I am just trying to get it to work at the moment. I will make them better later.
Edit:
After more research I have this Makefile now:
ISO_DIR := ..
ISO_FILE := uefi.iso
ISO_LABEL := UEFI
DIR_BLD := build
MKFSISO := xorriso -as mkisofs
FATHEADS := 32
FATTRACKS := 32
FATSECTOR := 512
FATTHING := 128
FATFORMAT := mformat
MMD := mmd
MCOPY := mcopy
all: buildDir $(ISO_DIR)/$(ISO_FILE)
.PRECIOUS: $(ISO_DIR)/$(ISO_FILE) $(DIR_BLD)/efi.img
$(ISO_DIR)/%.iso: $(DIR_BLD)/efi.img
$(MKFSISO) -o $# -iso-level 3 -V "$(ISO_LABEL)" $(DIR_BLD)/efi.img -e /efi.img -no-emul-boot
%.img:
$(FATFORMAT) -i $# -F -h $(FATHEADS) -t $(FATTRACKS) -n $(FATTHING) -c 1 -C
$(MDD) -i $# ::/EFI
$(MDD) -i $# ::/EFI/BOOT
$(MCOPY) -i $# ../bootloader/build/uefi.efi ::/EFI/BOOT/BOOTX64.EFI
clean:
rm -vf $(DIR_BLD)/efi.img $(ISO_DIR)/$(ISO_FILE)
buildDir:
mkdir -p $(DIR_BLD)
But I can not figure out how to make a GPT image with it, as mkgpt does not seem to exist.

Depending on the (virtual) medium type you need a partition table or
an El Torito Boot Catalog which mark an EFI System Partition.
Inside that partition must be a FAT filesystem with the start program.
The name of this program depends on the CPU Type. E.g. \EFI\BOOT\BOOTX64.EFI
for 64 bit Intel/AMD. For 32 bit Intel/AMD it's BOOTIA32.EFI.
So first of all you need to create that FAT filesystem image, with your
program having the prescribed name. Let's name the image file "efi.img"
and put it into the current working directory.
Then you put the FAT image file
as data file into the ISO and mark it as EFI El Torito boot image
so that EFI will find it on a (virtual) DVD medium.
xorriso -as mkisofs -o uefi.iso -iso-level 3 -V UEFI isoFiles \
./efi.img -e /efi.img -no-emul-boot
(Note that option -e expects the file address inside the ISO.)
For booting from (virtual) hard disk or USB stick, you'd append the
FAT filesystem image as MBR partition of type 0xEF:
xorriso -as mkisofs -o uefi.iso -iso-level 3 -V UEFI isoFiles \
-append_partition 2 0xef ./efi.img
(Note that option -append_partition expects the file address as on
local hard disk.)
Both add-ons can be combined at the cost of having two copies of the
FAT image in the ISO. xorriso versions >= 1.4.6 can avoid this duplication
by a special pseudo-path "--interval:..." with option -e:
xorriso -as mkisofs -o uefi.iso -iso-level 3 -V UEFI isoFiles \
-append_partition 2 0xef ./efi.img \
-e --interval:appended_partition_2:all:: -no-emul-boot

Related

Problem with makefile after rename variable

after changing the name of a variable into a makefile, its behavior changed drastically. From unsuccessful compilation to successful one.
I tried everything - different names, adding various additional conditions, but all without success.
Version of make:
$make --version
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
This is a source code file
int main(int argc, char *argv[])
{
return 0;
}
Original(desired) behavior makefile:
SHELL = /bin/sh
.SUFFIXES:
.SUFFIXES: .c .o
CC := gcc
LD := gcc
CFLAGS := -g
STRICT_CFLAGS := -Wall -Wextra -Wpedantic -Werror
INCLUDE_CFLAGS :=
ALL_CFLAGS := $(INCLUDE_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS)
STRICT_LDFLAGS := -Wall -Wextra -Wpedantic -Werror
INCLUDE_LDFLAGS :=
LDFLAGS := $(STRICT_LDFLAGS) $(INCLUDE_LDFLAGS) $(CFLAGS)
SOURCES := $(wildcard *.c)
BINARIES := $(SOURCES:%.c=%)
.PHONY: all
all: $(BINARIES)
%: %.o
#echo "Checking..."
$(LD) $(LDFLAGS) -o $#
.c.o:
#echo "Creating object..."
$(CC) $(ALL_CFLAGS) -c $< -o $#
.PHONY: clean
clean:
#echo "Cleaning up..."
-rm -rvf *.o $(BINARIES)
Compile output:
$make
gcc -g -Wall -Wextra -Wpedantic -Werror -g test.c -o test
test.c: In function ‘main’:
test.c:1:14: error: unused parameter ‘argc’ [-Werror=unused-parameter]
} return 0;nt argc, char *argv[])
^
test.c:1:26: error: unused parameter ‘argv’ [-Werror=unused-parameter]
} return 0;nt argc, char *argv[])
^
cc1: all warnings being treated as errors
make: *** [test] Error 1
Makefile after renaming variable (LDFLAGS -> T_LDFLAGS) - wrong behavior:
SHELL = /bin/sh
.SUFFIXES:
.SUFFIXES: .c .o
CC := gcc
LD := gcc
CFLAGS := -g
STRICT_CFLAGS := -Wall -Wextra -Wpedantic -Werror
INCLUDE_CFLAGS :=
ALL_CFLAGS := $(INCLUDE_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS)
STRICT_LDFLAGS := -Wall -Wextra -Wpedantic -Werror
INCLUDE_LDFLAGS :=
T_LDFLAGS := $(STRICT_LDFLAGS) $(INCLUDE_LDFLAGS) $(CFLAGS)
SOURCES := $(wildcard *.c)
BINARIES := $(SOURCES:%.c=%)
.PHONY: all
all: $(BINARIES)
%: %.o
#echo "Checking..."
$(LD) $(T_LDFLAGS) -o $#
.c.o:
#echo "Creating object..."
$(CC) $(ALL_CFLAGS) -c $< -o $#
.PHONY: clean
clean:
#echo "Cleaning up..."
-rm -rvf *.o $(BINARIES)
Compile output:
$make
gcc -g test.c -o test
Please someone explain to me why, after the name change, we lose flags for a strict code.
Thanks for your time!
Neither of your make targets are being hit. If you look at the output, you'll notice that Checking... is not printed and Creating object... is not printed. So your program is being build with the default target. This default target automatically adds $(CFLAGS) and $(LDFLAGS) to the build line. That's why things stopped working when you renamed LDFLAGS.
Also, your makefile currently is trying to create an executable for each individual .c file.
You need to change your targets as follows:
SOURCES := $(wildcard *.c)
OBJECTS := $(SOURCES:%.c=%.o)
BINARY := myprog
.PHONY: all
all: $(BINARY)
$(BINARY): $(OBJECTS)
#echo "Checking..."
$(LD) $(T_LDFLAGS) $(OBJECTS) -o $#
%.o: %.c
#echo "Creating object..."
$(CC) $(ALL_CFLAGS) -c $< -o $#
The OBJECTS variable will contain a list of .o files that correspond to each .c file. This will be the dependency list for the binary and the list of objects to link. The target for object files says to create a .o file for each .c file.

Can I build my PC file (Oracle Pro*c) conditionally inside of my application's make file?

I'm attempting to combine my makefiles so I can simply build once and it will precompile the pc file completely before continuing to build the application. This should be possible but for the life of me I cannot figure it out. Here is my makefile (for redhat 7).
COMPILEDATE = $(shell date)
COMPILE=g++ -std=c++11 -Wall -Wuninitialized -g
OSTYPE = $(shell uname)
LIBDIR=../../lib/
INC=../../include/
FILES=myProcess
OBJS= myProcess.o \
sqlStuff.o
O8P=$(ORACLE_HOME)
O8P=/u01/app/oracle/11.2.0/client_1
ORACLE_HOME=/u01/app/oracle/11.2.0/client_1
PROC_LINES=proc lines=yes code=ANSI_C iname=sqlStuff.pc parse=partial iname=sqlStuff include=. include=$(ORACLE_HOME)/precomp/public include=$(ORACLE_HOME)/rdbms/public include=$(ORACLE_HOME)/rdbms/demo include=$(ORACLE_HOME)/plsql/public include=$(ORACLE_HOME)/network/public
all: $(FILES)
compileInfo.o : FORCE
$(COMPILE) -c compileInfo.cpp -o $# -I$(INC) -DCDATE="\"$(COMPILEDATE)\"" -DBUILD="\"$(LSWBUILD)\""
FORCE :
%.o : %.cpp $(INC)myProcess.h
$(COMPILE) -c $< -o $# -I$(INC) -DCDATE="\"$(COMPILEDATE)\""
sqlStuff.o : sqlStuff.c
gcc -g -Wall -O -c -lclntsh -I. -I$(ORACLE_HOME)/precomp/public -I$(ORACLE_HOME)/rdbms/public -I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/plsql/lib -I$(ORACLE_HOME)/network/lib
sqlStuff.c : sqlStuff.pc
$(PROC_LINES)
myProcess: $(OBJS) $(LIBDIR)libbase.a $(INC)myProcess.h sqlStuff.o
$(COMPILE) -o myProcess$(OBJS) -L$(LIBDIR) -lbase
clean:
rm -f $(FILES)
rm -f sqlStuff
rm -f sqlStuff.c
rm -f sqlStuff.lis
rm -f $(OBJS)
rm -f core
rm -f *.out
rm -f *.log
rm -f *.err
My fault, I didn't explain what the issue was:
I'm compiling in netbeans using this build command: ${MAKE} -f Makefile. The error is PCC-S-02015, unable to open include file on my object that is not being precompiled, sqlStuff.o
Looking at the gcc command under sqlStuff.o : sqlStuff.c, it looks to me that there should be a -o sqlStuff.o flag to tell gcc that the output should be written to sqlStuff.o instead of the default, which is a.out.
Best of luck.

Why am I getting "nvcc fatal : redefinition of argument 'optimize'"?

I am trying to compile on MacBook Pro Retina with CUDA Driver Version: 7.0.36 and cuda toolkit 7.0 in a nVidia GT 750 M, the following code with its makefile but it gives me this error:
nvcc fatal : redefinition of argument 'optimize'.
Despite I have been able to compile and execute other programes with nvcc, with makefiles and so, now I am not.
Also, I have not been able to find something useful about this error so I ask it here if someone knows how to solve it. I am new with CUDA so if you need more information please ask for it.
Here is my Makefile.inc:
CXX := nvcc
OPTIM := -O3
DEBUG := -g -DOLB_DEBUG
CXXFLAGS := $(OPTIM)
ARPRG := ar
LDFLAGS := -O3
PARALLEL_MODE := OFF
OMPFLAGS := -fopenmp
BUILDTYPE := precompiled
INPUTDIR := ./input
OUTPUTDIR := ./output
INCDIR := ./inc
OBJDIR := ./obj
SRCDIR := ./HeatTransfer
BINDIR := ./bin
###########################################################################
## defines shell
SHELL := /bin/sh
and the Makefile:
###########################################################################
ROOT := .
include $(ROOT)/Makefile.inc
######################################################## Operational system
OS = $(shell uname -s)
MACH = $(shell uname -m)
HOST = $(shell uname -n)
WHOAMI = $(shell whoami )
###########################################################################
HeatTransfer := \
mesh\
stack
PROGRAM := $(BINDIR)/program
###########################################################################
OBJECTS := $(foreach file, $(HeatTransfer), $(OBJDIR)/$(file).o)
###########################################################################
all : compile link
###########################################################################
compile : $(OBJECTS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cu
#echo Compile $<
$(CXX) $(CXXFLAGS) -I$(INCDIR) -c $< -o $#
###########################################################################
link: $(PROGRAM)
$(PROGRAM): $(OBJECTS)
#echo Link $#
$(CXX) $(LDFLAGS) -I$(INCDIR) $(foreach file, $(HeatTransfer), $(OBJDIR)/$(file).o) $(LDFLAGS) -I$(INCDIR) -o $#
###########################################################################
clean : cleanprog cleanobj
cleanprog:
#echo Clean rubbish files
#rm -f *~ core .tmpfile $(PROGRAM)
cleanobj:
#echo Clean object files
#rm -f $(OBJECTS)
###########################################################################
###########################################################################
The complete messege when I try to compile is this:
...Heat_Transfer_CUDA$ make
Compile HeatTransfer/mesh.cu
nvcc -O3 -I./inc -c HeatTransfer/mesh.cu -o obj/mesh.o
Compile HeatTransfer/stack.cu
nvcc -O3 -I./inc -c HeatTransfer/stack.cu -o obj/stack.o
Link bin/program
nvcc -O3 -I./inc ./obj/mesh.o ./obj/stack.o -O3 -I./inc -o bin/program
nvcc fatal : redefinition of argument 'optimize'
make: *** [bin/program] Error 1
The problem is arising due to the fact that your link command is specifying the -O3 switch twice:
nvcc -O3 -I./inc ./obj/mesh.o ./obj/stack.o -O3 -I./inc -o bin/program
^^^ ^^^
And this is not allowed - it will produce that error.
The problem seems to occur due to the fact that your makefile specifies the use of LDFLAGS twice here:
$(CXX) $(LDFLAGS) -I$(INCDIR) $(foreach file, $(HeatTransfer), $(OBJDIR)/$(file).o) $(LDFLAGS) -I$(INCDIR) -o $#
which should not be necessary. Something like this instead:
$(CXX) $(LDFLAGS) -I$(INCDIR) $(foreach file, $(HeatTransfer), $(OBJDIR)/$(file).o) -o $#
should probably fix the issue.

makefile, size of an executable, static/dynamic

I have a makefile, for a C project with 2 sub-C-files and I can create two exe, one static and one dynamic.
But the static is lighter in space than the dynamic!
The programs can be launched and seems to be the sames
Is it normal?
Thank you very much, I have an exam in 2 days and I hope I will fix that problem :)
Simon
CC = gcc
CFLAGS = -Wall
CFLAGS2 = -shared
CFLAGS3 = -fPIC
LIB_U_CAM_TTL = -l_projet_vision_u_cam_ttl
LIB_SERIAL_LINUX = -l_projet_vision_serial_linux
CHEMIN = -L/usr/local/lib
lib_projet_vision_serial_linux.so: serial_linux.o
$(CC) $(CFLAGS2) $^ -o $#
lib_projet_vision_u_cam_ttl.so: u_cam_ttl.o
$(CC) $(CFLAGS2) $^ -o $#
lib_projet_vision_serial_linux.a : serial_linux.o
ar -rv $# $^
lib_projet_vision_u_cam_ttl.a : u_cam_ttl.o
ar -rv $# $^
projet_vision_dynamic: main_vision.c install
$(CC) $(CFLAGS3) $^ $(CHEMIN) $(LIB_SERIAL_LINUX) $(LIB_U_CAM_TTL) -o $#
projet_vision_static: main_vision.c install
$(CC) $^ $(CHEMIN) $(LIB_SERIAL_LINUX) $(LIB_U_CAM_TTL) -o $#
%.o : %.c
$(CC) $(CFLAGS) -c $< -o $#
install: lib_projet_vision_serial_linux.so lib_projet_vision_serial_linux.a lib_projet_vision_u_cam_ttl.so lib_projet_vision_u_cam_ttl.a
sudo cp -f *.h /usr/local/include/
sudo cp -f *.so /usr/local/lib/
sudo cp -f *.a /usr/local/lib/
sudo cp projet_vision_dynamic /usr/bin/
sudo cp projet_vision_static /usr/bin/
sudo ldconfig
uninstall: clean
sudo rm -f /usr/local/include/serial_linux.h
sudo rm -f /usr/local/include/u_cam_ttl.h
sudo rm -f /usr/local/lib/lib_projet_vision_serial_linux.so
sudo rm -f /usr/local/lib/lib_projet_vision_u_cam_ttl.so
sudo rm -f /usr/local/lib/lib_projet_vision_u_cam_ttl.a
sudo rm -f /usr/local/lib/lib_projet_vison_serial_linux.a
sudo ldconfig
clean:
rm -f *.o *~ *.so *.a
rm -f projet_vision_static projet_vision_dynamic

How to write a shell script to compile multiple embedded sql in C files (.sqc)?

I have written 3 .sqc files i.e. embedded sql in host language C. I need to make a (Unix) shell script to simply compile all 3 sqc files in a row. How can I do that? Right now, I can individually run each .sqc file using a Makefile that basically converts the .sqc file to a c file and then compiles it. Can I make 3 individual Makefiles and run all of them through a shell script? If so, then how? Can I make one Makefile that can compile all 3 .sqc independently and compile them thereafter through a shell script? If so, then how? Any other options?
Here is the Makefile that can only compile a single .sqc file:
NAME=sample
DB2PATH = /sqllib
CC=gcc
CFLAGS=-I$(DB2PATH)/include
LIBS=-L$(DB2PATH)/lib -R$(DB2PATH)/lib -ldb2
all: $(NAME)
$(NAME): $(NAME).sqc util.o
db2 connect to sampleDB
db2 prep $(NAME).sqc bindfile
db2 bind $(NAME).bnd
db2 connect reset
$(CC) $(CFLAGS) -c $(NAME).c
$(CC) $(CFLAGS) -o $(NAME) $(NAME).o util.o $(LIBS)
clean:
rm -f $(NAME) $(NAME).c $(NAME).o $(NAME).bnd
util.o : util.c
$(CC) -c util.c $(CFLAGS)
A possible (Unix) shell script and Makefile example would suffice to help.
Thank you.
This Makefile should do all three in one step, just type "make". Note that you'll have to change the second line to reflect the names of your real .sqc files.
Also note that I'm not familiar with sqc and I haven't tested this, I'm just working from your Makefile.
# THIS IS THE ONLY LINE YOU'LL HAVE TO CHANGE:
NAMES = file1 file2 file3
DB2PATH = /sqllib
CC=gcc
CFLAGS=-I$(DB2PATH)/include
LIBS=-L$(DB2PATH)/lib -R$(DB2PATH)/lib -ldb2
all: $(NAMES)
# This will convert .sqc into .c
%.c: %.sqc
db2 connect to sampleDB
db2 prep $< bindfile
db2 bind $*.bnd
db2 connect reset
# This will compile .c into .o, whether it's fileN.c or util.c
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $#
# This will link fileN.o and util.o into fileN
$(NAMES): % : %.o util.o
$(CC) $(CFLAGS) -o $# $^ $(LIBS)
# This is just to assure Make that that isn't really a file called "clean"
.PHONY: clean
clean:
rm -f $(NAMES) $(NAMES:=.c) $(NAMES:=.o) $(NAMES:=.bnd)
DB2PATH = /sqllib
CC=gcc
CFLAGS=-I$(DB2PATH)/include
LIBS=-L$(DB2PATH)/lib -R$(DB2PATH)/lib -ldb2
all: $(NAME)
$(NAME): $(NAME).sqc util.o
db2 connect to sampleDB
db2 prep $(NAME).sqc bindfile
db2 bind $(NAME).bnd
db2 connect reset
$(CC) $(CFLAGS) -c $(NAME).c
$(CC) $(CFLAGS) -o $(NAME) $(NAME).o util.o $(LIBS)
clean:
rm -f $(NAME) $(NAME).c $(NAME).o $(NAME).bnd
util.o : util.c
$(CC) -c util.c $(CFLAGS)
suppose you have three files: file1.sqc file2.sqc file3.sqc, and your makefile is saved as mksqc.mk
Script:
make -f mksqc.mk NAME=file1
make -f mksqc.mk NAME=file2
make -f mksqc.mk NAME=file3